| ||||||||||
| 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:No clue why I get WAIn Reply To:No clue why I get WA Posted by:terto at 2005-10-11 16:48:35 also tried this in g++:
#include <iostream>
#include <vector>
using namespace std;
int gimme(__int64 int a){
if (a == 0) return 0;
if (a%2 == 1) return 1 + gimme(a/2);
else return gimme(a/2);
}
int main()
{
__int64 target = 20;
__int64 startFrom = 0;
__int64 howMany;
__int64 n;
__int64 vueltas, i;
cin>>vueltas;
n = 1;
while(vueltas > 0){
vueltas--;
cin>>target;
cin>>howMany;
cin>>startFrom;
if ((startFrom > target)||(startFrom < 1) ||(startFrom + howMany > target + 1)) cout <<"Case "<< n <<": It cannot be solved."<<endl;
else{
cout << "Case "<<n<<":";
for (i = startFrom; i<startFrom + howMany; i++) cout << " "<<gimme(i);
cout <<endl;
}
n++;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator