題源來自---CCF計算機職業資格認證官網,點擊報名入口,可進行模擬考試進行練習。代碼在最後。
代碼
n=int(input()) a=[0]*4 m=0 i=0 while i<(n+m): i+=1 if (i%7==0)or(str(7) in list(str(i))): a[i%4-1]+=1 m += 1 for i in a: print(i)
題源來自---CCF計算機職業資格認證官網,點擊報名入口,可進行模擬考試進行練習。代碼在最後。
代碼
n=int(input()) a=[0]*4 m=0 i=0 while i<(n+m): i+=1 if (i%7==0)or(str(7) in list(str(i))): a[i%4-1]+=1 m += 1 for i in a: print(i)