Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|---|
74590 | 陈路垚 | 幸运数字 | C++ | Compile Error | 0 | 0 MS | 0 KB | 500 | 2023-05-27 16:34:13 |
#include<bits/stdc++.h> using namespace std; bool chuan(char [],int); bool xingyun(int a){ if(a%4==0||a%7==0) return true; char b[10]; itoa(a,b,10); if(chuan(b,sizeof b-1)) return true; return false; } bool chuan(char c[],int d){ for(int i=0;i<=d-2;i++){ if(c[i]=='4'&&c[i+1]=='4') return true; if(c[i]=='7'&&c[i+1]=='7') return true; } return false; } int main(){ int a,ans=0; cin>>a; for(int i=1;i<=a;i++){ if(xingyun(i)) ans++; } cout<<ans; return 0; }