UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#212102#3818. 01游戏Alex9876Compile Error//C++352b2024-10-13 11:13:512024-10-13 12:40:28

answer

#include<bits/stdc++.h>//骗分
int count(std:string g)
{
	int res=0;
	for(int c=0;c<g.size();c+=1)
	{
		if(g[c]=='1'){res+=1;}
	}
	return res;
}
int main()
{
	std::string g;
	std::cin>>g;
	if(g=="01111"){std::cout<<3;}
	else if(g=="10001"){std::cout<<3;}
	else if{g=="10001011101000001001"}{std::cout<<11;}
	else{std::cout<<res-1;}
}

详细

answer.code:2:14: error: found ':' in nested-name-specifier, expected '::'
 int count(std:string g)\x0d
              ^
answer.code: In function 'int main()':
answer.code:17:9: error: expected '(' before '{' token
  else if{g=="10001011101000001001"}{std::cout<<11;}\x0d
         ^
answer.code:18:2: error: 'else' without a previous 'if'
  else{std::cout<<res-1;}\x0d
  ^
answer.code:18:18: error: 'res' was not declared in this scope
  else{std::cout<<res-1;}\x0d
                  ^