Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|---|
41222 | 王籽易 | 幸运数字 | C++ | Wrong Answer | 0 | 1 MS | 248 KB | 432 | 2022-06-11 15:18:03 |
#include <bits/stdc++.h> using namespace std; int n,ans; int check(int i){ int a[9],t=1; while(i){ a[t]=i%10; i/=10; t++; } for(int i=1;i<=t;i++){ if(a[i]==4&&a[i+1]==4){ for(int j=1;j<=t;j++){ if(a[j]==7&&a[j+1]==7){ return 1; } } } } return 0; } int main(){ cin>>n; for(int i=1;i<=n;i++){ if(i%4==0||i%7==0||check(i)){ ans+=1; } } cout<<ans; return 0; }