Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int n;
- int a, b, c, d;
- int hours, minutes;
- void solve(){
- cin >> a >> b >> c >> d;
- if(a == 2 || b == 2 || c == 2 || d == 2){
- if(b == 2) swap(a, b);
- if(c == 2) swap(a, c);
- if(d == 2) swap(a, d);
- }
- else{
- if(a == 1 || b == 1 || c == 1 || d == 1){
- if(b == 1) swap(a, b);
- if(c == 1) swap(a, c);
- if(d == 2) swap(a, d);
- }
- else{
- int minimum = min(min(a, b), min(c, d));
- if(b == minimum) swap(a, b);
- if(c == minimum) swap(a, c);
- if(d == minimum) swap(a, d);
- }
- }
- int maksimum = max(b, max(c, d));
- if(c == maksimum) swap(b, c);
- if(d == maksimum) swap(b, d);
- if(c < d) swap(c, d);
- hours = 10*a+b;
- minutes = 10*c+d;
- if(minutes > 59 || hour > 24) cout << "ERROR";
- else cout << a << b << ":" << c << d;
- }
- int main(){
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- cout.tie(NULL);
- cin >> n;
- while(n>1){
- n--;
- solve();
- cout << "\n";
- }
- solve();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement