| 
 | 
вернуться в форумCould you tell me what's wrong with my program?(I got WA 2) Послано  yuyan 14 янв 2009 08:29 What's wrong with my program?Could you give me some test? Thank you! Sorry for my poor English!:) Here is my program: #include<iostream.h> int main() {  freopen("financial.in","r",stdin);  freopen("finiancial.out","w",stdout);  int testcase;  cin>>testcase;  int i,m,n;  bool flag;  for (int t=1;t<=testcase;t++)    {     cin>>n;     m=1;     while (n%2==0)       {        n=n>>1;        m+=1;       }     if ((m%2==1) && (n>1))       cout<<"YES"<<endl;     else {           flag=false;           for (i=2;i<=n-1;i++)             if (n%i==0)               {                flag=true;                break;               }           if (flag) cout<<"YES"<<endl; else cout<<"NO"<<endl;          }    }  return 0; }   Thank you for your help! Re: Could you tell me what's wrong with my program?(I got WA 2) Послано  Vadick 16 янв 2009 18:11 try this test 1 8 the correct answer is YES, but your answer is NO Re: Could you tell me what's wrong with my program?(I got WA 2) Послано  yuyan 16 янв 2009 19:07 Thanks for your help. I got AC finally.  |  
  | 
|