#include <iostream> using namespace std; int main() { int seconds=0,hours=0,minutes=0; scanf("%d",&seconds); while(seconds<0&&seconds>100000000){ scanf("%d",&seconds); }//超出1~10000000s的范围重新输入 minutes=seconds/60;//算出分钟 while(minutes>=60){ minutes-=60;//保证分钟不超过60 hours++;//每60进一小时 } seconds=seconds%60;//求出剩余秒数 printf("%d %d %d",hours,minutes,seconds); return 0; } // 64 位输出请用 printf("%lld")