/*
1、函数判断是否含有7
2、循环计数
i++
i含有7或者是7的倍数则 skip[turn]++,
不是则count++,到20结束
turn=turn+1%4;初始为0,turn在0/1/2/3中循环
3、 循环结束条件count==20;
*/
#include<cstdio>
#include<iostream>
using namespace std;
int n;
int skip[4];
bool skipJudge(int i){
if(i%7==0) return true;
int t=0;
while(i&&t!=7){
t=i%10;
i/=10;
}
if(t==7) return true;
return false;
}
int main(){
int turn=0,count=0,i=1;
scanf("%d",&n);
while(count<n){
if(skipJudge(i)){
skip[turn]++;
}
else count++;
turn=(turn+1)%4;
i++;
}
for(int j=0;j<4;j++){
printf("%d\n", skip[j]);
}
return 0;
}
201912-1报数
猜你喜欢
转载自blog.csdn.net/weixin_46148956/article/details/106176601
今日推荐
周排行