6 / 6
Apr 2018

See the code below. The problem may be at t=input(). Cuz even I add exit() below t=input(), I get NZEC..
I'm new to python. Plz help me. Thank you!

Click https://www.spoj.pl/problems/DOUGHNUT/4 to see the problem description.

# SPOJ 4138. Harry and big doughnuts
t=input()
for tt in range (0,t):
	c,k,w=([int(x) for x in raw_input().split()])
	if c*w<=k:
		print "yes"
	else:
		print "no"
  • created

    Sep '09
  • last reply

    Apr '18
  • 5

    replies

  • 1.0k

    views

  • 4

    users

  • 1

    link

I change t=input() into t=int(raw_input()) and get AC luckily. Can anybody tell me why?

input() is equivalent to eval(raw_input()) and eval() can't handle windows newlines whereas int() can:

>>> int("100\r")
100
>>> eval("100\r")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1
    100
      ^
SyntaxError: unexpected EOF while parsing
>>> eval("100\n")
100
4 years later

Masz rację Narbej. Wybrałem przykład z testów Filipa, który jest niezgodny z zakresem, ale chciałem wskazać miejsce, w którym wynik w moim odczuciu różni się od prawidłowego. To, że jest spoza zakresu nie zmienia faktu, że wynik nie jest poprawny.
Ale dobrze, wybiorę inny, zgodny z zakresem przykład. Pozycja piętnasta z testu Filipa:

1
44897763

out Filipa:

22448880

mój out:

7482960

Tak, żeby być precyzyjnym w treści zadania napisane jest, że [tex]$t\textgreater10$[/tex] więc [tex]$n\leq90909090$[/tex] smile

4 years later