Bah, I am so retarded. Fixed it... lol... I forgot to optimize the length. I knew there had to be a "decision statement" some where:) One max and it's all good.
Russian war tactics are fairly strange; their generals are stickers for mathematical precision. Their missles will always be fired in a sequence such that there will only be one solution to the problem posed above.
After checking my code again and again, I think my original
code is right. But it still gets WA>< Another question: if
the input is '1 3 2 5 4', what should I output?'1 3 5' or
'1 3 4'? Or could you mail me your code and let me read it?
I managed to get your code working just by some cleaning up and some stricter writing of it - for example you assume that all characters in the input are digits, what about spaces, and other symbols ? You can just rewrite it with sscanf.
I think data reading is the problem.
The original code:
[c]
for(y=0,t=0;s[y]!='\0';y++)
t=t*10+s[y]-'0';
[/c]
got WA.
But when I replaced it with below
[c]
for(y=0,t=0;s[y]!='\0';y++)
if(s[y]>='0' && s[y]<='9')
t=t*10+s[y]-'0';
[/c]
or
[c]
t=atoi(s);/*I have included stdlib.h*/
[/c]
got RE.
I skip any characters except the digits and got RE instead.
Do you have any suggestion on this?ex. reading by sscanf