|
|
back to boardWA#1 My program works correctly on all tests from the forum: 50 500 --> 854559745684320697549060368131279814466643179689928095831053239604130293492672614469791533133321 50 450 --> 3834688188199309756675466732967588185862422492337212276545580039517258085033387305291001857619600 10 2 --> 100 50 1000 --> 0 3 1 --> 0 50 250 --> 41409732703108026572448942476041207839411119408173570127621420289526490759097327483136 50 300 --> 3660144008320861404705392514284143308670326732628084621145897204106027006076468826991924409 5 10 --> 15876 50 896 --> 1625625 10 10 --> 4008004 49 2 --> 2401 1 20 --> 0 50 0 --> 1 , but I got WA#1! I used DP and long arithm. What it can be caused by? Edited by author 08.04.2010 05:42 Edited by author 08.04.2010 05:43 Re: WA#1 Maybe the problem is in I/O? Re: WA#1 Do you mean problems with output? I tried this for(int i=A.N-1; i>=0; i--) cout<<A.A[i]; , this for(int i=A.N-1; i>=0; i--) printf("%d", A.A[i]-'0'); and this for(int i=A.N-1; i>=0; i--) printf("%c", A.A[i]); A.A -- array of char, my long number. Re: WA#1 My input: int N, S; cin>>N>>S; o_O Re: WA#1 Posted by ile 10 Apr 2010 01:15 i don't know if it's a problem but you probably want to check if S is odd then output is 0. something like 10 1 --> 0 and you know that if S > 9*2*n then output is also 0. Edited by author 10.04.2010 01:16 Re: WA#1 Posted by sklyack 10 Apr 2010 01:34 Yes, 10 1 --> 0, my program works correctly on this test. And for each odd S it outputs 0: it contains if(S%2) { cout<<0; return 0; } . And yes, if S > 9*2*n it outputs 0. For example 5 90 --> 1 5 91 --> 0 5 92 --> 0 40 720 --> 1 40 721 --> 0 40 722 --> 0 I almost sure in my solution, I really have no idea what wrong with the program, but I got WA. And the most strange that I got WA on the first test !!! Edited by author 10.04.2010 01:34 Edited by author 10.04.2010 01:36 Re: WA#1 ostream &operator <<(ostream &out, vector<int> a){ out << a.back(); FOR(i,0,a.size()-2) out << setfill('0') << setw(9) << a[i]; return out; } // main cout << vector<int>(1, 2356) << endl; Edited by author 17.04.2011 06:34 Edited by author 17.04.2011 06:34 |
|
|