提交时间:2023-05-27 14:09:48

运行 ID: 74518

#include<bits/stdc++.h> using namespace std; int n,ans; int main(){ cin>>n; for(int x=1;x<=n;x++){ if(x%4==0||x%7==0) ans++; else{ int x1=x,last=0; while(x1>0){ int ne=x1%10; if(ne==7&&last==7||ne==4&&last==4){ ans++; break; }else last=ne; x1/=10; } } } cout<<ans; return 0; }