• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Mar 19th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. #include <bits/stdc++.h>
2.
3. using namespace std;
4.
5. int n;
6. int a, b, c, d;
7.
8. int hours, minutes;
9.
10. void solve(){
11.     cin >> a >> b >> c >> d;
12.     if(a == 2 || b == 2 || c == 2 || d == 2){
13.         if(b == 2) swap(a, b);
14.         if(c == 2) swap(a, c);
15.         if(d == 2) swap(a, d);
16.     }
17.     else{
18.         if(a == 1 || b == 1 || c == 1 || d == 1){
19.             if(b == 1) swap(a, b);
20.             if(c == 1) swap(a, c);
21.             if(d == 2) swap(a, d);
22.         }
23.         else{
24.             int minimum = min(min(a, b), min(c, d));
25.             if(b == minimum) swap(a, b);
26.             if(c == minimum) swap(a, c);
27.             if(d == minimum) swap(a, d);
28.         }
29.     }
30.     int maksimum = max(b, max(c, d));
31.     if(c == maksimum) swap(b, c);
32.     if(d == maksimum) swap(b, d);
33.     if(c < d) swap(c, d);
34.     hours = 10*a+b;
35.     minutes = 10*c+d;
36.     if(minutes > 59 || hour > 24) cout << "ERROR";
37.     else cout << a << b << ":" << c << d;
38. }
39.
40. int main(){
41.     ios_base::sync_with_stdio(false);
42.     cin.tie(NULL);
43.     cout.tie(NULL);
44.
45.     cin >> n;
46.     while(n>1){
47.         n--;
48.         solve();
49.         cout << "\n";
50.     }
51.     solve();
52. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Not a member of Pastebin yet?