NZEC error in Python

前端 未结 5 1931
自闭症患者
自闭症患者 2021-01-13 13:31

this is a simple piece of code which is suppose to read n numbers and suppose to print how many numbers out of these n numbers are divisible by k

n=int(raw_i         


        
5条回答
  •  孤街浪徒
    2021-01-13 14:16

    I suppose the codechef question is this one. You should take in account that the value of n and k are around 10^7, which could be a problem with your program.

    Also, n and k are on the same line. You are using raw_input twice, so you are reading two lines. This can be solved by using:

    n, k = raw_input().split(" ")
    n = int(n)
    k = int(k)
    

    If that won't help, you could try looping over an xrange instead, or using a different algorithm.

提交回复
热议问题