| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 107424 | 何思佳 | 二进制转十进制 | C++ | Compile Error | 0 MS | 0 KB | 219 | 2025-01-17 17:09:54 |
#include<bits/stdc++.h> using namespace std; int main() { string s; cin>>s; int ejz=1; int sum=0; for(int i=s.size()-1;i>=0;i--) { if(s[i]=='1'){ sum+=w; } w*=2; } cout<<sum; return 0; }
Main.cc: In function 'int main()':
Main.cc:10:9: error: 'w' was not declared in this scope
sum+=w;
^
Main.cc:12:3: error: 'w' was not declared in this scope
w*=2;
^
Main.cc:6:6: warning: unused variable 'ejz' [-Wunused-variable]
int ejz=1;
^