|
|
back to boardto admin: ¿Accepted? Posted by Une 5 Feb 2009 07:46 I got accepted but the algoritm is wrong. It fails on 6 6 6 5 4 3 2 my answer = 2 the real answer = 0 (6+5+2 6+4+3) #include <stdio.h> int main(){ int n; int sum(0), half(0); int stones[100000]; scanf("%d",&n); for(int c=0; c<n;c++){ scanf("%d",&stones[c]); sum+=stones[c]; } half=sum/2; for(int c=0; c<n; c++) if(half>=stones[c])half-=stones[c]; printf("%d\n",(half*2+sum%2)); } Up Posted by OpenGL 20 Mar 2009 13:48 Re: to admin: ¿Accepted? Posted by 2rf 20 Mar 2009 18:37 i can be wrong, but i think your test consists three "6" while in your "real answer" there are only two of them) Re: to admin: ¿Accepted? Posted by OpenGL 20 Mar 2009 19:47 You are wrong. Author wrote test in one line. First number is a count of stone. Right test 6 6 6 5 4 3 2, right answer 0, author answer 2. up Posted by OpenGL 24 Mar 2009 14:04 up Posted by OpenGL 27 Mar 2009 01:43 up Posted by OpenGL 31 Mar 2009 23:05 up Posted by OpenGL 8 Apr 2009 17:38 Admins! Is really bug on this problem! Pleace add this test. Re: to admin: ¿Accepted? Posted by holtaf 14 Nov 2010 23:15 it fails also on 5 5 8 13 27 14 .... the real answer is 3 but yours is 15!! Re: to admin: ¿Accepted? strange but admin did not add test for this wrong solution. i sent it(solution) to system and system accepted it! |
|
|