CSP第18次 201912-1 报数 C语言满分答案
#include <stdio.h>
int main() {
int n;
int count[4]={0};
int num,m=0;
scanf("%d",&n);
for(num=1;m<n;num++){//从1开始,所以索引1代表甲
if(num%7==0||num%10==7||(num/10)%10==7||(num/100)%10==7)
count[num%4]++;
else m++;
}
printf("%d\n%d\n%d\n%d\n",count[1],count[2],count[3],count[0]);
return 0;
}