| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 62858 | 杨宜炜 | 二进制小数转十进制 | C++ | Compile Error | 0 MS | 0 KB | 370 | 2023-12-30 14:21:52 |
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int ans,d=s.find("."),len=s.size(); if(d==-1){ for(int i=len-1;i>=0;i--){ ans+=(s[i]-'0')*pow(a,len-1-i) } }else{ for(int i=d-1;i>=0;i--){ ans+=(s[i]-'0')*pow(a,d-1-i) } for(int i=d+1;i<len-1;i++){ ans+=(s[i]-'0')*pow(a,d-1-i) } } cout<<ans; }
Main.cc: In function 'int main()':
Main.cc:9:24: error: 'a' was not declared in this scope
ans+=(s[i]-'0')*pow(a,len-1-i)
^
Main.cc:13:24: error: 'a' was not declared in this scope
ans+=(s[i]-'0')*pow(a,d-1-i)
^
Main.cc:16:24: error: 'a' was not declared in this scope
ans+=(s[i]-'0')*pow(a,d-1-i)
^