Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
99896 付老师 二进制转十进制 C++ Runtime Error 0 MS 284 KB 445 2024-12-01 09:50:19

Tests(0/20):


Code:

#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(){ int b=0; char a[20]; cin>>a; int len=strlen(a); for(int i=0,j=len-1;i<len&&j>=0;i++,j--){ b+=((a[j]-'0')*pow(2,i)); } cout<<b<<endl; return 0; }


Run Info:

*** stack smashing detected ***: ./Main terminated