#include<bits/stdc++.h>
using namespace std;
struct worktime{
int h,m,s;
worktime operator+(const worktime x)const{
worktime tmp;
tmp.s=(s+x.s)%60;
tmp.m=(m+x.m+(s+x.s)/60)%60;
tmp.h=h+x.h+(m+x.m+(s+x.s)/60)/60;
return tmp;
}
};
int main(){
worktime stu,sum;
int n;
cin>>n;
sum.h=sum.m=sum.s=0;
for(int i=1;i<=n;i++){
cin>>stu.h>>stu.m>>stu.s;
sum=sum+stu;
}
cout<<sum.h<<"hour"<<" "<<sum.m<<"minute"<<" "<<sum.s<<"second";
return 0;
}
作业统计(结构体与共同体)
最新推荐文章于 2024-08-29 16:57:08 发布