CSP 201912-1 报数(python)

文章目录

题目

在这里插入图片描述
这题比较水,加上用的是python,考场上几分钟就写完了。

考场代码

n=int(input())
flag=0
count1=[0,0,0,0]
count=0
num=1
while(count!=n):
    if '7'in str(num) or num%7==0:
        count1[flag]+=1
    else:
        count+=1
    flag=(flag+1)%4
    num+=1
for i in count1:
    print(i)

结果

在这里插入图片描述

发布了12 篇原创文章 · 获赞 2 · 访问量 355

猜你喜欢

转载自blog.csdn.net/qq_42295427/article/details/104284241
今日推荐