-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathntoj_514.cpp
More file actions
35 lines (28 loc) · 761 Bytes
/
ntoj_514.cpp
File metadata and controls
35 lines (28 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <bits/stdc++.h>
using namespace std;
int main() {
int p,q,r;
cin>>p>>q>>r;
vector<int> numbers;
for (int a=1;a<=9;++a) {
for (int b=0;b<=9;++b) {
if ((p==0&&a>=b)||(p==1&&a<=b))
continue;
for (int c=0;c<=9;++c) {
if ((q==0&&b>=c)||(q==1&&b<=c))
continue;
for (int d=0;d<=9;++d) {
if ((r==0&&c>=d)||(r==1&&c<=d))
continue;
int num=a*1000+b*100+c*10+d;
numbers.push_back(num);
}
}
}
}
sort(numbers.begin(),numbers.end());
for (const int num:numbers) {
cout<<num<<endl;
}
return 0;
}