|
|
May be u have WA2 in this case: 1 1 output have to be: NO u need to find out can u from 1 get N in odd number of this operations : multiply number by odd number or 2 Here some testcases and my AC program's answers. May be these would be helpful for you. Good Luck. 10 NO 100 YES 1000 YES 8 YES 16 NO 32 YES 64 NO 125 YES 126 YES 1 NO 12345678 YES 17 YES 107 YES 267 YES 2992 YES 987456 YES 769 YES 896 NO 1536 NO 796 YES did you guys consider months after december ? say april 2011 ? because they can fly there in 2009 or after, right ? I bed speak english :) Last date is 25 of december (1 ≤ N ≤ 2(25)) try this test 1 100 outp YES on this test I understand my mistake Why should that be YES. Isn't that 1 2 2 5 5---> 5 December odd, so NO payment ? because 100 is also 1*2*2*25 and if it is possible the answer is yes second test contains n=1 Edited by author 25.01.2009 16:29 But sample contains test 6, and 6=1*6, so we can recieve our money on 2 December (2 is even). But answer in sample is NO. Who can explain me this? Read the problem statements careful. No! Second test doesn't contain n = 1. In second test n > 1 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! try this test 1 8 the correct answer is YES, but your answer is NO Thanks for your help. I got AC finally. 1 9 YES or NO if YES how??? if answer is 1*9=9 then look this 1 4 NO we can write like this: 1*4=4 and answer will be YES; for 4 answer isn't 1*4, because you can't write even number>2 1 9 1) 9=1*3*3 => answer="NO" 2) 9=1*9 => answer="YES" Thanks Edited by author 25.12.2008 21:16 Because, if quantity{amount} of multipliers even that the answer "YES", else "NO". yeah it sucks up really bad man. authors should make more explanations on that. i think the second one is right since i did it using first and it failed. |
|
|