Run ID Author Problem Lang Verdict Score Time Memory Code Length Submit Time
74618 张志鹏 幸运数字 C++ Accepted 100 14 MS 252 KB 371 2023-05-27 16:46:08

Tests(5/5):


#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; } return 0; } int main(){ cin>>n; for(int i=4;i<=n;i++){ if(check(i)) ans++; } cout<<ans; return 0; }


Judgement Protocol: