ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1079. Maximum

(help)i think my code is right,can you help me?(WA1)
Posted by Boqian Jiang 11 Mar 2010 17:55
i think it will work out fine.
But just got WA1.
Can you help me ?
thx!






#include <cstdlib>
#include <iostream>

using namespace std;


int shu(int);


int main(int argc, char *argv[])
{
    int a[10],b=0,max=0,d=0;
    while (cin>>a[b])
    {if (a[b]==0) break;
     b++;}
     while (1)
     {if (a[d]==0) break;
      while (a[d]>=0)
      {if (shu(a[d])>max) max=shu(a[d]);
       a[d]--;}
       cout<<max<<endl;
       d++;}

    system("PAUSE");
    return EXIT_SUCCESS;
}

  int shu(int n)
  {int c;
   if (n==0) c=0;
   else if (n==1) c=1;
   else if (n%2==0) c=shu(n/2);
   else c=shu((n-1)/2)+shu((n-1)/2+1);}


Re: (help)i think my code is right,can you help me?(WA1)
Posted by GaoHughes 6 Sep 2010 21:40
I have the same trouble whit you,WA1!!!
But I test it myself whit my computer but find nothing wrong!
Re: (help)i think my code is right,can you help me?(WA1)
Posted by sweet_ht 23 Oct 2010 18:20
" //system("pause"); "