PAT乙級1026程式執行時間(秒數轉換為時間)(值得學習)

weixin_45663946發表於2020-10-26

https://pintia.cn/problem-sets/994805260223102976/problems/994805295203598336


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    double a,b;
    cin>>a>>b;
    int c=round((b-a)/100);
    int h=c/3600;
    int m=c%3600/60;
    int s=c%60;
    printf("%02d:%02d:%02d",h,m,s);
    return 0;
}

相關文章