Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
50218 | jiabokai | 【例72.1】 二进制转化为十进制 | C++ | No Test Data | 0 MS | 0 KB | 208 | 2024-08-14 19:08:46 |
#include<bits/stdc++.h> using namespace std; int main(){ int k,m=0; string s; cin>>k>>s; int n=k; for(int i=0;i<k;i++){ s[i]-='0'; m+=s[i]*pow(2,n-1); n--; } cout<<m; return 0; }