-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_My_First_Sorting_Problem.cpp
More file actions
81 lines (72 loc) · 1.53 KB
/
A_My_First_Sorting_Problem.cpp
File metadata and controls
81 lines (72 loc) · 1.53 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*____________________________________________________
|Author: Ki6ui-Par1na
|Date: 2024/05/10
|Time: 20:35:31
|Problem: A_My_First_Sorting_Problem
|_____________________________________________________ */
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define yes cout << "YES" << endl;
#define no cout << "NO" << endl;
#define print(n) cout << (n) << endl;
#define tc ll t; cin >> t; while(t--)
// Check Prime Number
bool is_prime(int n) {
if (n <= 1)
return false;
for (int i = 2; i <= sqrt(n); i++) {
if (n % i == 0)
return false;
}
return true;
}
// Factorial Function
ll factorial(int n) {
ll fact = 1;
for (int i = 1; i <= n; i++) {
fact *= i;
}
return fact;
}
// Composite Number Check
bool is_composite(int n) {
return !is_prime(n);
}
// Binary Search
bool bin_search(int l, int r, int arr[], int x) {
while (l <= r) {
int mid = (l + r) / 2;
if (arr[mid] == x) {
return true;
} else if (arr[mid] < x) {
l = mid + 1;
} else {
r = mid - 1;
}
}
return false;
}
// Sum of Digits
ll digit_sum(ll n) {
ll sum = 0;
while (n > 0) {
sum += n % 10;
n /= 10;
}
return sum;
}
void solve() {
tc{
int a, b; cin >> a>> b;
if( a > b) cout << b << ' ' << a << endl;
else cout << a << ' ' << b << endl;
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
solve();
return 0;
}