#include <bits/stdc++.h>
using namespace std;
bool shouldSkip(int x) {
if (x % 7 == 0) return true; // 7的倍数
auto s = to_string(x);
if (find(s.begin(), s.end(), '7') != s.end()) return true; // 含有数字7
return false;
}
int main() {
int n;
cin >> n;
vector<int> cnt(4);
int cur = 1;
while (n) {
if (shouldSkip(cur)) {
++cnt[(cur - 1) % 4];
} else {
--n;
}
++cur;
}
for (int x: cnt) cout << x << endl;
return 0;
}
来源:CSDN
作者:Touchig
链接:https://blog.csdn.net/Touchig/article/details/104049805