python - 正确的示例输出但未在 codechef 上被接受
问题描述
我正在尝试使用 Python 语言解决这个初学者问题:https ://www.codechef.com/problems/ZUBTRCNT
我已经编写了在示例案例中给出正确输出的代码。它提供与其他接受的答案相同的输出。但是我的代码没有被接受。
供参考:(我的代码不被接受):https ://www.codechef.com/viewsolution/40506063
case=int(input())
for c in range(case):
l,k=map(int,input().split())
n = l - k + 1
sum = n * (n + 1) // 2
print("Case {}:".format(c+1),sum)
(另一人成功回答):https ://www.codechef.com/viewsolution/39844942
t=int(input())
for i in range(0,t):
l,k=map(int,input().split())
if(l<k):
print("Case "+str(i+1)+":","0")
else:
m=l-k+1
m=m*(m+1)//2
print("Case "+str(i+1)+":",m)
解决方案
推荐阅读
- php - 如何使用 mysql 在 docker 中配置和运行旧的 php 5.4 Web 应用程序?
- migration - 从 1.10 升级到 1.11 时无法从保存点恢复 Flink 键控状态后端
- r - R 找不到 MATLAB 运行时
- python - 如何在没有指定参数的张量流中初始化单位矩阵?
- mysql - 如何从 MySQL 表列中获取带有精确 TLD 的域名?
- javascript - Css 变换比例不适用于模态卡弹出窗口
- jdbc - Kafka Connect JDBC sink - 将 Avro 字段写入 PG JSONB
- reactjs - 如何识别字符串值是日期字符串还是不是反应
- java - 如何在 Java Poet 中添加函数的参数化返回类型
- nutch - Nutch 任何人都可以解释 readdb stats 中的状态名称是什么