ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#212102 | #3818. 01游戏 | Alex9876 | Compile Error | / | / | C++ | 352b | 2024-10-13 11:13:51 | 2024-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 ^