| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 19540 | 孙文谦 | 幸运数字 | C++ | Accepted | 100 | 240 MS | 252 KB | 784 | 2021-05-16 16:53:48 |
#include <bits/stdc++.h> using namespace std; char str[10]={'0'}; int main() { int n,i,sum=0,j; cin>>n; for(i=1;i<=n;i++) { sprintf(str,"%d",i); if(i%4==0) { sum+=1; continue; } else if(i%7==0) { sum+=1; continue; } else { for(j=0;j<strlen(str);j++) { if(str[j]=='4'&&str[j+1]=='4') { sum+=1; break; } if(str[j]=='7'&&str[j+1]=='7') { sum+=1; break; } } } } cout<<sum<<endl; return 0; }