Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:No clue why I get WA

Posted by terto at 2005-10-11 16:50:03 on Problem 2108
In 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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator