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 1001. Reverse Root

Python Что не так в коде?
Posted by FY0u11 14 Mar 2017 01:17
from re import *
from math import sqrt

result = findall('[0-9]+', input())
result.reverse()

for i in result:
    print('{:.4f}'.format(sqrt(int(i))))

Edited by author 14.03.2017 01:20
Re: Python Что не так в коде?
Posted by ToadMonster 17 Mar 2017 14:33
For the most tasks WA1 means your program can't even solve sample.

Have you tried to run it locally? It's clearly visible it doesn't work.

Here's my run:
http://ideone.com/T9g8rU

There is only 2 numbers in output so your program processed first input line only.

Edited by author 17.03.2017 14:35
Re: Python Что не так в коде?
Posted by master8282 20 Jul 2017 03:24
Hey admins! His code works well as my, but it doesn't pass on your side.

As the prove look bellow:

"
with open('/tmp/123.txt', 'r') as f:
    string = f.read()

from re import *
from math import sqrt

result = findall('[0-9]+', string)
result.reverse()

for i in result:
    print('{:.4f}'.format(sqrt(int(i))))
"
Answer
"
runfile('/home/ant/.config/spyder-py3/temp.py', wdir='/home/ant/.config/spyder-py3')
2297.0716
936297014.1164
0.0000
37.7757
"

You have mistakes in comparation analysis on your side.
Re: Python Что не так в коде?
Posted by Denis 4 Oct 2017 22:17
Hi, master8282
please, take a look at rules:
В решениях задач запрещается:
работа с любыми файлами;
...
(Source: http://acm.timus.ru/help.aspx?topic=judge)

here is the problem, since your code based on file reading.