'commit'
This commit is contained in:
26
TangDou/XiTi/DiZengShu.cpp
Normal file
26
TangDou/XiTi/DiZengShu.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//求递增数组 11-10001之间的
|
||||
bool IsDiZeng(int n) {
|
||||
int lastGe, ge = 10;
|
||||
while (n > 0) {
|
||||
lastGe = ge;
|
||||
ge = n % 10;
|
||||
n /= 10;
|
||||
if (ge > lastGe) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int count = 0;
|
||||
for (int i = 12; i <= 10000; i++) {
|
||||
if (IsDiZeng(i)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
cout << count << endl;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user