标准的水题,不过用的方式并不是多好。
#include <stdio.h>
int main() {int n=0;scanf("%d",&n);for(int i=0;i<n;i++){int ah,am,as,bh,bm,bs;int ch,cm,cs;//定义一组数据计算算出来scanf("%d %d %d %d %d %d",&ah,&am,&as,&bh,&bm,&bs);//份cs = (as+bs)%60 >0 ? (as+bs) %60 : 0;cm = (am + bm + ( as + bs ) / 60 ) % 60 > 0 ? (am+bm+ ((as+bs)/60))%60 :0;ch = (ah + bh + ( am + bm + ( ( as + bs ) / 60 ) ) / 60 ) % 60 > 0 ? (ah+bh+ ((am+bm + ((as+bs)/60) )/60) ) :0;printf("%d %d %d\n",ch,cm,cs);}return 0;
}