Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iomanip>
- #include <iostream>
- using namespace std;
- class Time {
- private:
- int h,min,s,sec;
- public:
- Time(): h(0), min(0), s(0) {}
- Time(int x,int y,int z): h(x), min(y), s(z) {}
- ~Time() {}
- void Ivedimas()
- {
- cin >> h >> min >> s;
- }
- void Skaiciavimas()
- {
- sec = (((h*60)+min)*60+s);
- }
- int graz_sekundes()
- {
- return sec;
- }
- };
- int main() {
- int n, h, s, min;
- int max = -10000000, maxi = -10;
- cin >> n;
- Time T[100];
- for (int i = 0; i < n; i++)
- {
- T[i].Ivedimas();
- T[i].Skaiciavimas();
- }
- for(int i = 0; i < n; i++)
- {
- for(int j = 0; j < n; j++)
- {
- maxi = T[i].graz_sekundes() + T[j].graz_sekundes();
- if(maxi >= 86400)
- {
- maxi = maxi-86400;
- }
- if(i!=j && maxi > max)
- {
- max=maxi;
- }
- }
- }
- h = max/3600;
- min = (max-h*3600)/60;
- s = max%60;
- if((h<=9&&min<=9)&&s<=9)
- cout<<"0"<< h << ":"<<"0"<< min << ":"<<"0"<< s << endl;
- if((h<=9&&min<=9)&&s>=10)
- cout<<"0"<< h << ":"<<"0"<< min << ":"<<s << endl;
- if((h<=9&&min>=10)&&s<=9)
- cout<<"0"<<h<<":"<<min<<":"<<"0"<<s<<endl;
- if((h<=9&&min>=10)&&s>=10)
- cout<<"0"<< h << ":"<< min<< ":"<< s << endl;
- if((h>=10&&min>=10)&&s>=10)
- cout<< h << ":"<< min << ":"<< s << endl;
- if((h>=10&&min>=10)&&s<=9)
- cout<< h << ":"<< min<< ":"<<"0"<< s << endl;
- if((h>=10&&min<=9)&&s<=9)
- cout<< h << ":"<<"0"<< min<< ":"<<"0"<< s << endl;
- if((h>=10&&min<=9)&&s>=10)
- cout<< h << ":"<<"0"<< min<< ":"<< s << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement