解题思路:
算法标签:模拟
代码:
// TSWorld
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
const int N = 50;
bool iscount(int number) {
if(number % 7 == 0)
return false;
int temp = 0;
while(number != 0) {
temp = number%10;
if(temp == 7)
return false;
number /= 10;
}
return true;
}
int people[10];
int main()
{
int times = 1;
int ans = 0;
int n = 0;
cin>>n;
while(ans < n) {
for(int i = 1;i <= 4;i++) {
if(ans >= n)
break;
if(!iscount(times)){
people[i]++;
times++;
continue;
}
else {
times++;
ans++;
continue;
}
}
}
for(int i = 1;i < 4;i++)
cout<<people[i]<<endl;
cout<<people[4];
return 0;
}