#include <cmath>
#include <iostream>
int perevod(bool a, int minutes)
{
if (a)
return floor(static_cast<float>(minutes) / 60);
}
else
return minutes % 60;
int main()
int hours, hours1, hours2;
int minutes, minutes1, minutes2;
std::cin >> hours >> minutes;
std::cin >> hours1 >> minutes1;
std::cin >> hours2 >> minutes2;
int temp = minutes + minutes1 + minutes2;
minutes = perevod(0, temp);
hours += perevod(1, temp) + hours1 + hours2;
std::cout << hours << " " << minutes;
return 0;
// Mingw
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <cmath>
#include <iostream>
int perevod(bool a, int minutes)
{
if (a)
{
return floor(static_cast<float>(minutes) / 60);
}
else
{
return minutes % 60;
}
}
int main()
{
int hours, hours1, hours2;
int minutes, minutes1, minutes2;
std::cin >> hours >> minutes;
std::cin >> hours1 >> minutes1;
std::cin >> hours2 >> minutes2;
int temp = minutes + minutes1 + minutes2;
minutes = perevod(0, temp);
hours += perevod(1, temp) + hours1 + hours2;
std::cout << hours << " " << minutes;
return 0;
}
// Mingw