|
|
вернуться в форумto admin: ¿Accepted? Послано Une 5 фев 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 Послано OpenGL 20 мар 2009 13:48 Re: to admin: ¿Accepted? Послано 2rf 20 мар 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? Послано OpenGL 20 мар 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 Послано OpenGL 24 мар 2009 14:04 up Послано OpenGL 27 мар 2009 01:43 up Послано OpenGL 31 мар 2009 23:05 up Послано OpenGL 8 апр 2009 17:38 Admins! Is really bug on this problem! Pleace add this test. Re: to admin: ¿Accepted? Послано holtaf 14 ноя 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! |
|
|