题解 | #挑7#
挑7
https://www.nowcoder.com/practice/ba241b85371c409ea01ac0aa1a8d957b
#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
while (cin >> n) {
int res = 0;
for (int i = 1; i <= n; ++i) {
if (i % 7 == 0) {
++res;
continue;
} else {
string str = to_string(i);
for (auto j : str) {
if (j == '7') {
++res;
break;
}
}
}
}
cout << res << endl;
}
return 0;
}
#23届找工作求助阵地##我的实习求职记录##14天坚持打卡##零基础学习C++#
