1 solutions
-
0
#include<bits/stdc++.h> using namespace std; int main() { int n,m; cin>>n>>m; int cnt=0; //判断是否有奇妙数 for(int i=n;i<=m;i++) //枚举范围 { int t=i; bool st=true; //判断当前数是否是奇妙数 while(t) { int ge=t%10; if(ge==0) //0就删除以后继续 { t/=10; continue; } if(i%ge!=0) //不满足奇妙数 { st=false; } t/=10; //删除个位 } if(st) { cnt++; cout<<i<<" "; } } if(cnt==0) { cout<<-1; } return 0; }
- 1
Information
- ID
- 1249
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 1
- Tags
- # Submissions
- 22
- Accepted
- 9
- Uploaded By