Here is the relevant loop:
numTestCases = int(raw_input())
for numCase in range(numTestCases):
line = raw_input().split(' ')
lower=int(line[0])
upper=int(line[1])+1
primes=primes_below(upper)
for prime in primes:
if prime>=lower:
print prime
print
I am also trying:
inputs = sys.stdin.read().split('\n')
numTestCases = int(inputs[0])
for numCase in range(numTestCases):
line = inputs[numCase+1].split(' ')
lower=int(line[0])
upper=int(line[1])+1
primes=primes_below(upper)
for prime in primes:
if prime>=lower:
print prime
print
Am I misunderstanding how input is handled on SPOJ? I've already completed ID1 but it does not really deal with input formatting of the same nature. I can verify that the algorithm works, but for whatever reason, SPOJ isn't liking the submission. Any advice would be helpful -- thanks!
created
last reply
- 20
replies
- 905
views
- 5
users
- 9
links