Why CE? UVa 575

General topic about Valladolid Online Judge

Moderator: Board moderators

Post Reply
sourav.776
New poster
Posts: 1
Joined: Thu Dec 07, 2017 10:24 pm

Why CE? UVa 575

Post by sourav.776 » Tue Jan 30, 2018 10:54 pm

#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;
}

dibery
Learning poster
Posts: 76
Joined: Sat Feb 23, 2013 4:16 pm
Location: Taiwan, Taipei
Contact:

Re: Why CE? UVa 575

Post by dibery » Mon Feb 19, 2018 5:50 am

Submit as C++11.
The C++ option does not support gets().
BTW, you should be able to read to compilation error message in your submission page.
Life shouldn't be null.

Post Reply

Return to “General”