我正在用codechef https://www.codechef.com/problems/INTEST解决这个问题
我正在使用下面的代码,它在我的系统上给出了正确的答案,但当我提交时却给出了错误的答案。为什么会这样呢?
#include <stdio.h>
int main(void)
{
unsigned int n, k, ti, dv;
scanf("%d %d", &n, &k);
int i = 0;
while (i < n)
{
scanf("%d", &ti);
if ((ti % k) == 0)
dv++;
i++;
}
printf("%d", dv);
return 0;
}我尝试了一下问题页面上的输入,得到了正确的答案。
发布于 2021-05-31 13:18:50
下面是我对这个问题的Python3解决方案:
try:
n,k=map(int,input().split())
count=0
for i in range(n):
x=int(input())
if x%k==0:
count+=1
print(count)
except:
pass发布于 2020-06-16 23:19:58
Python3解决方案-
n,k = list(map(int,input().split()))
count = 0
for _ in range(n):
if (int(input()) % 3 == 0):
count+=1
print(count)https://stackoverflow.com/questions/33665557
复制相似问题