| geezle86 (8) | |||
|
The problem : http://codeforces.com/problemset/problem/4/A my solution :
but when everyitme i submit, and the site test my code, then the site always say "Wrong answer on test 5". Test 5 maybe means line 5 (?). Is there anything wrong with my solution ? Thanks. | |||
|
|
|||
| fafner (222) | |
This line is not valid c++ syntax (and doesn't make any sense)int w=(1<=w<=100);Do you want w to be a random number between 1 and 100? If so the code is: int w = rand()%100;EDIT: I see in the problem-text that it says 1<=w<=100. That just means that the input your code will be getting will be between 1 and 100 inclusive. | |
|
Last edited on
|
|
| trojansdestroy (53) | |
In line 7, you only need int w;The problem described w as an integer between 1 and 100 for your own personal information; it doesn't affect the coding at all, and you don't need to initialize w here, since the cin in the next line does so. Other than that your code looks fine.
| |
|
Last edited on
|
|
| fafner (222) | |
| Also, your code doesn't correctly answer the problem. In addition to checking w%2==0, you also need to check that the two parts are even :) | |
|
|
|
| ne555 (4041) | |
|
Read the problem carefully. Test the limits. By instance, ¿which should be the output for `w=2'? | |
|
|
|