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

Why do I get Runtime Error for solution in Python 3.4
Posted by SabraO 1 Jun 2016 19:15
import sys;
import math;

class Stack:
    def __init__(self):
        self.items = []

    def isEmpty(self):
        return self.items == []

    def push(self, item):
        self.items.append(item)

    def pop(self):
        return self.items.pop()

    def peek(self):
        return self.items[len(self.items) - 1]

    def size(self):
        return len(self.items)

size = 0
intSize = sys.getsizeof(int());
s = Stack();

while (size<100):
    line = input();
    if (not line.isspace()):
        values = [int(s) for s in line.split() if s.isdigit()];
        size += intSize;
        for value in values:
            s.push(math.sqrt(value));

while (s.size()>0):
    print("%.4f" % (s.pop()));
Re: Why do I get Runtime Error for solution in Python 3.4
Posted by ToadMonster 2 Jun 2016 12:46
> while (size<100):

How did you receive magic number "100"? Shouldn't you read input until EOF?