Search found 1 match

by sourav.776
Tue Jan 30, 2018 10:54 pm
Forum: General
Topic: Why CE? UVa 575
Replies: 2
Views: 1219

Why CE? UVa 575

#include<bits/stdc++.h>
using namespace std;
int main()
{
char ar[101];
while(true)
{
gets(ar);
int l=strlen(ar);
long dec=0;
for(int i=0;i<l;i++)
{
dec+=(pow(2,l-i)-1)*(ar-'0');
}
if(dec!=0)cout<<dec<<endl;
else break;
}

return 0;
}

Go to advanced search