ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1437. Gasoline Station

whywaidontknow ADMINS! YOUR SERVER IS ONE BIG BUG! [4] // Problem 1437. Gasoline Station 30 Aug 2006 12:11
problem#1437 WA #1
it's impossible;
2 cases: "crash(int div by zero)" or "output limit"
but you server give WA

WHY!?

include <stdio.h>
int main()
{
    int N;
    scanf("%i",&N);
int b;
scanf("%i",&b);
scanf("%i",&b);
    if (N==0) N=b/0; else while (true) printf("123442343234234343423243242344");
    return 0;
}
Samsonov Alex [USU] Re: ADMINS! YOUR SERVER IS ONE BIG BUG! [3] // Problem 1437. Gasoline Station 30 Aug 2006 12:34
Do you know what "Output Limit Exceeded" means? Think about it before being rude.
whywaidontknow Re: ADMINS! YOUR SERVER IS ONE BIG BUG! [2] // Problem 1437. Gasoline Station 30 Aug 2006 12:49
while (true) printf("123123123123");
gets output limit

I know why this program don't work.
it's optimization, I must add in last line
"printf("%i",N);"

in VS 6.0 program gets crash anyway

but I realy don't understand, why it gets WA#1
this program on test #1 (0 3 4) don't output anything

Edited by author 30.08.2006 12:55
Sometimes 1/0 isn't crash :(
I tried to find mistakes in one my program so, but didn't receive crash - as you.
Vladimir Yakovlev (USU) Compiler tries to optimize your code (+) // Problem 1437. Gasoline Station 5 Sep 2006 00:16
Compiler tries to optimize your code and do not run last command (N=b/0) because value of N is not used after this assignment.