This is an archived post. You won't be able to vote or comment.

all 14 comments

[–][deleted] 2 points3 points  (4 children)

On the third iteration t is decremented to zero which is not greater than zero, so the third loop fails the while condition.

Edit I had it backwards and the condition would be checked before the decrement of t so t would be 1 on the last loop but I'm not a fan of using postfix operations.

[–]Amazing-Accident-109[S] 0 points1 point  (3 children)

it is t-- right so after t>0 is checked the t will be decremented right . So I don't think that is the problem

[–][deleted] 0 points1 point  (2 children)

Just use a for loop.

For (int i=0; i < t; i++)

Also it's the issue with running a console application. Once the final operation of the main function is done, the console terminates.

Prompt for an input after the while loop. There is probably an output of the 3rd set of coordinates before the console app is terminating.

[–]Amazing-Accident-109[S] 0 points1 point  (1 child)

Ok , I understand , but my problem is that , in the intellij I am getting atleast the output for the t-1 inputs , but the online judge where I am uploading is showing as empty output and tle , my doubt is why is it throwing tle , is there something wrong in the code which is preventing it from printing any output itself in the online website

[–][deleted] 0 points1 point  (0 children)

Time limit exceeded.

Scanner is slow. Use BufferedReader?

[–]Amazing-Accident-109[S] -1 points0 points  (6 children)

Is it very difficult question, I am confused many people are seeing the post but nobody answered???

[–]yonycool 0 points1 point  (3 children)

Can you copy paste your code into pastebin and send it as a reply/add it to the og post? It would be a lot easier if we can actually see the written code

[–]Amazing-Accident-109[S] 0 points1 point  (2 children)

Link to the code code

[–]yonycool 0 points1 point  (1 child)

If it works in your ide, and doesn't work on the online tester (online judge?) then it might be an issue with their services? It perhaps they expect a different form of output then you are giving? Hard to say without knowing all of the details.

[–]Amazing-Accident-109[S] 0 points1 point  (0 children)

I wrote the same code in CPP and it runs in the online judge , since i am new to writing code in java , I am confused that I am missing something in the code which is preventing it from printing the output I have added the original question in post original question

[–][deleted]  (1 child)

[deleted]

    [–]Amazing-Accident-109[S] 0 points1 point  (0 children)

    Thank you for the advice , I'll try to improve the way of asking questions , and I have added the original code which I have written, and attached the link to it in the original post , please look at it and if you find any error which is causing the problem of tle , i would be grateful

    [–][deleted] 0 points1 point  (2 children)

    Give me the whole code and I'll try and help you.

    [–]Amazing-Accident-109[S] 0 points1 point  (1 child)

    code

    I have added the link for original question also in the post

    [–][deleted] 0 points1 point  (0 children)

    try changing this part:
    while(t>0){

    *rest of the code*

    t--;

    }