| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 19736 | 鱼锁嵘 | 幸运数字 | C++ | Accepted | 100 | 136 MS | 256 KB | 780 | 2021-05-21 21:54:40 |
#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; }