编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#5056 #1031. 统计 Compile Error 0 0 ms 0 K C++ 17 / 425 B harkerbest 2024-02-25 15:22:43
显示原始代码
n, q = map(int, input().split())
student_list = list(map(int, input().split()))

student_list_minor = [0 for i in range(n)]
student_list_minor[0] = student_list[0]
for i in range(1,len(student_list)):
    student_list_minor[i] = student_list[i] - student_list[i-1]

for i in range(q):
    l, r = map(int, input().split())
    zero = student_list_minor[l:r].count(0)
    count = 1 + r - l - zero
    print(count)

编译信息

/sandbox/1/a.cpp:1:1: error: 'n' does not name a type
    1 | n, q = map(int, input().split())
      | ^