'commit'
This commit is contained in:
24
TangDou/LanQiaoBei/LanQiao12XuanBaSaiZhongJi/3_1.cpp
Normal file
24
TangDou/LanQiaoBei/LanQiao12XuanBaSaiZhongJi/3_1.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
|
||||
// 数位递增数
|
||||
bool dzs(string s) {
|
||||
for (int i = 0; i < s.size() - 1; i++)
|
||||
if (s[i] > s[i + 1]) return false;
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
25
|
||||
|
||||
答案:13
|
||||
*/
|
||||
int main() {
|
||||
int n;
|
||||
cin >> n;
|
||||
int cnt = 0;
|
||||
for (int i = 11; i <= n; i++)
|
||||
if (dzs(to_string(i))) cnt++;
|
||||
|
||||
printf("%d\n", cnt);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user