https://www.acmicpc.net/problem/2530
#include <iostream> using namespace std; int main() { int h,m,s,n; cin>>h>>m>>s>>n; int sum=s+n; m+=sum/60; sum%=60; h+=m/60; m%=60; h%=24; cout<<h<<" "<<m<<" "<<sum; }