×

# input output in python

 0 I am having issues with time limits and large inputs using python. I have tried both input() and sys.stdin.readline(). Fail 'enormous input test' in practice and also believe this issue is keeping me from earning full points on several problems in competitions. This is frustrating as it seems as if Python submissions are being accepted they should be accommodated... otherwise wby accept them... Here is my code for enormous input test: import sys n, k = [int(i) for i in sys.stdin.readline().strip().split()] c = 0 for i in range(n): if int(sys.stdin.readline().strip()) % k == 0: c += 1 print(c)  asked 04 Jan '15, 12:56 1●2 accept rate: 0%

 0 Do not use strip and also use Python 2.7. Here is your accepted solution. import sys n, k = [int(i) for i in sys.stdin.readline().strip().split()] c = 0 for i in range(n): if int(sys.stdin.readline()) % k == 0: c += 1 print(c)  answered 04 Jan '15, 13:17 4★the65bit 1.1k●10●13●28 accept rate: 13% Thank you! (04 Jan '15, 19:10) Welcome!!! If it helped, Please upvote and accept it as correct answer ;) (04 Jan '15, 19:24) the65bit4★
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×27
×24
×3

question asked: 04 Jan '15, 12:56

question was seen: 2,068 times

last updated: 04 Jan '15, 19:24