|
|
Общий форумGot WA2. please respond. Cleared the fault. But now WA 16. Cleared the fault. But now WA 16. Using C++. Is it a problem due to using long double? See this test: 6 2 2 2 3 3 3 Bad answer: 5 Good answer: 3 Maybe new problem with increase S,K) 5 500 250 250 250 250 250 ------------------- 22288580 I'm curious how do you solve this problem so fast, could you give me some hint?? or send you code to my email:qizichao@gmail.com THX I managed to reach the same time, but only once :) I've sent the same solution using c++ and ruby - and ruby's version works 8 times slower than c++ solution and hardly passes TL (however all solutions were accepted, working time 0,125 vs 0,984 sec). I hope it might be caused by the old interpreter's version - can we use any newer version? int a = getc(stdin); read by simbol Before reading of spaces you must read rules of webboard! Speak in English! char ch; while(cin.get(ch)) { } можно вводить строку с пробелами целиком для string s; getline(cin, s); можно вводить символ char ch; ch = getchar(); эта штука позволяет вводить не только пробелы, но и символы перевода строк и прочее. в основном, пользуюсь этими двумя способами. the problem says " Moreover, they check only that the sum of all numbers entered since the last test matches the expected one." Thus should the new number entered in the test to check whether there is a big bang or not? If we have to take into account last input i.e. k value the the problem statement is incorrect. Please could someone explain this. Finally AC! understood the problem now. I wa#4, plz explain the problem for me Finally AC! understood the problem now. Can you give explanation?, please! Edited by author 10.09.2011 18:56 p=3.14159 Thank you, SIAL_alky! Edited by author 26.02.2015 18:22 Edited by author 26.02.2015 18:23 If your program fails at tests #2, #3 check if it work correct for N = 1, 2. Edited by author 22.03.2015 17:58 here's my text: program Project2; var a,b,c,d:longint; begin readln (a,b,c,d); while c>a do begin a:=a+b; c:=c-d; end; if c=a+b then writeln (c) else writeln (a);
end. what's the problem??? help me please 4 3 6 1 correct answer: 6 thanks but now wa is #6 can't understand what ellse I've missed. give me your code program Project2; var a,b,c,d:longint; begin readln (a,b,c,d); if c<a+b then writeln (c) else begin while c>a do begin a:=a+b; c:=c-d; end; writeln (a); end;
end. If a>c in the beginning then answer is a not c. Also check whether a>c after adding b each time. Here is correct code var a,b,c,d:integer; begin Readln(a,b,c,d); While a<=c do begin a:=a+b; if a>c then a:=c; c:=c-d; end; Write(a); end. Edited by author 09.11.2009 14:56 correct answer is 7. 4 3 6 1 correct answer is 7 WHY??? Petr offers 4 Taxi says 6 Petr won't increase because 4+3>6 => the answer is 7 correct answer is 6! Read the task carefully!! No correct answer must be 6. Because, Peter offer: 4 but when you add 3 it will be 7>6 in this case a must be equal 6. Beacause driver satisfy 6 money. In this case put this condition to your iterator: if(a>c) a=c; I have Python 3.4.3 on my PC and when I run the program, this happens: input: 3 4 5 3 output: 5 4 3 I am certain that is the correct answer, but the judge says that it is incorrect Ordering of start can be exploited to find solution. Edited by author 22.03.2015 03:35 Viewing other authors solutions have many benefits for viewer: - Learning clean coding style. - Learning new ways to solve the problem. - Learning tricks from people who solved the problem using similar idea. - Checking if tests are weak by exploring weaknesses in other people code. The memory limit is terrible! so small! Increase it plz!!! Edited by author 21.03.2015 14:43 My program works wrong when N = 10^K, but gets AC! Please add test with such N. To Admins: my AC program gives wrong answers for 105, 20087. Please add these numbers to tests. please help me if you have O(n^2) algorithm for this problem . thanks From my knowledge i know there is possible only O(n^3) maxlongint maxlongint 2 2 1 1 2 2 Good Luck !! Both of the answers are zero, is that right? > maxlongint maxlongint > 2 > 2 > > 1 1 > 2 > 2 > > Good Luck !! 1 maxlongint 2 2 Good Luck ! Is it 465. All Tests You Give I'm Right But I'm WA on Test7 Can you give me more Edited by author 31.08.2005 18:40 Test: 1 2147483647 20 2 Answer: 84672315 Test: 1 2147483647 13 3 Answer: 77520 thanks I also got wa on test7,but the answer to your test is right.help. you kan use srank() function generate some random Numbers.then get answers! INPUT: 11445 15494 4 4 15058 26207 4 2 12750 12846 8 4 732 2989 9 3 749 12704 1 7 14656 26121 14 7 16994 21479 9 3 4648 19157 8 2 12866 14795 10 7 9980 30071 1 9 9052 17238 11 2 10029 19550 4 8 20819 23330 15 6 8962 30778 1 3 6203 19518 3 3 11637 31672 4 5 21687 23438 1 2 18506 19510 6 10 17544 25821 5 3 1348 10295 15 4 374 11047 5 4 18148 24741 10 6 915 13370 11 2 20304 20342 3 6 21842 26940 15 10 3256 23852 7 8 6582 23422 2 9 12158 21258 4 10 20670 29891 14 6 8045 12108 4 8 3143 7795 3 9 23581 25647 15 6 9414 31532 3 5 240 2698 1 2 13974 28320 8 2 22376 27437 12 2 3448 15240 2 3 26614 28463 5 8 1 100000000 20 2 ANSWER: 0 342 0 0 1 0 1 2928 0 0 286 0 0 1 28 20 0 0 70 0 21 0 154 0 0 0 2 0 0 0 6 0 15 4 3148 76 8 1 373295 Little correction to above answers :) one before the last and some other tests will result 0 instead of 1 and the answer 21 should be 20 Also, for 16994 21479 9 3 correct answer is 0, not 1 Some of your data is wrong →_→ I have WA 4, and I think because I never write "NO". When answer is NO? Wnen Sum of SR and SC are different or when MaxFlow = 0 or when credit can't be < 100? for example: 2 201 201 201 201 Answer is: "NO" Becouse one of solve: 100 101 101 100 but 101 more then 100 Что не так? Мой алгоритм кажется мне верным. Когда проверяю вручную на VS ответы правильные даёт. |
|
|