腾讯第二题,数组或语法错误
腾讯第二题,数组越界或者语法错误,本地IDE牛客测试上都能跑,问题出自哪里
import math t,k = [int(i) for i in input().split()] for i in range(t): a,b = [int(j) for j in input().split()] total_num = 0 for num in range(a,b+1): range_num = 1 if num//k<1: total_num+=range_num elif num//k>=1: p = num//k for q in range(1,p+1): #print('ss') num_q = num-q*k+q num_a = math.factorial(num_q) num_b = math.factorial(q) num_c = math.factorial(num_q-q) tt = num_a/num_b/num_c range_num+=tt total_num+=range_num print((int(total_num))%(10**9+7))#腾讯##笔试题目#