| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:贴一下,留念超越In Reply To:贴一下,留念超越 Posted by:troy24 at 2010-08-06 19:22:43 > #include<iostream>
> #include<string>
> #include<math.h>
> using namespace std;
> long long arr[33];
> int main()
> {
> ifstream cin("test.txt");
> int j;
> for(j=0;j<32;j++)
> {
> arr[j] = pow(2.0,j+1.0) - 1;
> }
> string str;
> int len,i;
> long long sum;
> while(cin>>str && (str != "0"))
> {
> len = str.length(); sum = 0;
> for(i=0;i<len;i++)
> {
> sum += (str[i] - '0')*arr[len-i-1];
> }
> cout<<sum<<endl;
> }
> return 0;
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator