题解 | #挑7#
挑7
https://www.nowcoder.com/practice/ba241b85371c409ea01ac0aa1a8d957b
#include <iostream> using namespace std; int main() { int a, b=0; while (cin >> a ) { // 注意 while 处理多个 case for (int i=1; i<=a; i++) { if (i%10==7||i%7==0||(i/10)%10==7||(i/100)%10==7||(i/1000)%10==7||(i/10000)%10==7) { b++; } } cout << b << endl; } }