runtime error in UVA Online judge that i can not solve it

This is the place for queries that don't fit in any of the other categories.

runtime error in UVA Online judge that i can not solve it

Postby x64 » Fri Sep 23, 2016 8:20 am

For Uva Online judge problem No : 113
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=49
here they said that input file terminated by EOF(end of file) but i can not solve it
my code is below here:
Code: Select all
import math
n = int(input())
x = int(input())

while n > 0 and x > 0:
    y = (x ** (1/n))

    z = math.ceil(y)
    print(z)
    n = int(input())
    x = int(input())


help to solve the problem.
thanks in advance
x64
 
Posts: 5
Joined: Fri Sep 09, 2016 4:09 pm

Re: runtime error in UVA Online judge that i can not solve i

Postby micseydel » Fri Sep 23, 2016 3:25 pm

I don't see anything on the page you linked to about EOF. Do you get an error message? A traceback? Anything that can help us to help you?
Due to the reasons discussed here we will be moving to python-forum.io on October 1, 2016.

This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
micseydel
 
Posts: 3000
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: runtime error in UVA Online judge that i can not solve i

Postby x64 » Fri Sep 23, 2016 6:12 pm

in this link the problem described but not told EOF but they not told how to terminate the input .......thats why we need to stop input as EOF(eof in c programming i knew that)....but in python i can't

this is the similar type of problem is easy problem but runtime error because i can not terminate the input in c programming i can use (Ctrl + z) to terminate this kind of problem that is the EOF in c programming but i cant terminate input in python for this kind of problem, i think now you realize what i said.........another problem :
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3565

Code: Select all
while True:
    x = input()
    print(x)


when i use "while True" but it not accepted because of not terminate the input
help to solve the problem whithout using "while True"
thanks in advance
x64
 
Posts: 5
Joined: Fri Sep 09, 2016 4:09 pm

Re: runtime error in UVA Online judge that i can not solve i

Postby micseydel » Fri Sep 23, 2016 6:51 pm

How about
Code: Select all
import sys

lines = sys.stdin.readlines()

?

Otherwise, you can try catching an EOFError within you loop, but I'm not sure that'll work.
Due to the reasons discussed here we will be moving to python-forum.io on October 1, 2016.

This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
micseydel
 
Posts: 3000
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA


Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 6 guests