Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
102893 | 万隽宇 | 二进制转十进制 | C++ | Runtime Error | 0 MS | 284 KB | 472 | 2024-12-26 19:12:45 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ char n[20]; cin>>n; int j=strlen(n),a=0; int k=j-1; for(int i=0;i<j;i++){ if(k>=0){ a+=(n[k]-'0')*pow(2.0,i); } k--; } cout<<a; return 0; }
*** stack smashing detected ***: ./Main terminated