提交时间:2023-05-27 16:44:26

运行 ID: 74610

#include<bits/stdc++.h> using namespace std; int n; int ans; int check(int x){ if(x%4==0) return 1; if(x%7==0) return 1; int k1=0,k2=0; while(x){ k2=k1; k1=x%10; if(k2==4&&k1==4) return 1; if(k2==7&&k1==7) return 1; x/=10; } } int main(){ cin>>n; for(int i=4;i<=n;i++){ if(check(i)) ans++; } cout<<ans; return 0; }