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 1409. Two Gangsters

Output limit exceeded
Posted by sikder_social 30 Sep 2016 18:15
What is wrong in my code? Thanks

[code deleted]

Edited by moderator 19.11.2019 23:57
Re: Output limit exceeded
Posted by Oleg Baskakov 30 Sep 2016 18:21
Well, there's only two numbers in the input. For some reason you're using while, and for some reason it leads to infinite cycle apparently. Try to replace your while with if.
Also, you assume there's exactly 10 cans total. This is not true. The task says "no more than 10".

Edited by author 30.09.2016 18:25
Re: Output limit exceeded
Posted by ToadMonster 30 Sep 2016 19:40
while becomes endless because of mistake:
Current state: while(scanf("%d %d",&a,&b)!=EOF && a<11 || b<11){
Should be: while(scanf("%d %d",&a,&b)!=EOF && (a<11 || b<11)){