1 条题解
-
0
C++ :
#include<bits/stdc++.h> using namespace std; int a,b,ans = 0; bool check(int x){ if(x < 10){ return true; } int t = x % 10;//前一次的尾数 while(x != 0){ x = x / 10; //如果当前数>=其后面的数,则不是幸运数 if(x % 10 >= t) return false; t = x % 10; } return true; } int main() { cin>>a>>b; for(int i = a;i <= b;i++){ if(check(i)){ ans++; } } cout<<ans; return 0; }
- 1
信息
- ID
- 991
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 10
- 标签
- 递交数
- 3
- 已通过
- 3
- 上传者