PAT乙级 1026 程序运行时间

#include 
using namespace std;
int main()
{
    double x,y;
    cin>>x>>y;
    x = y-x;
    x = x/10;
    if(((int )x%10)>4)
    {
        x = x/10;
        x = (int)x;
        x+=1;
    }
    else
    {
        x = x/10;
        x = (int)x; 
    } 
    int temp1= x/3600;
    if(temp1!=0)
    {
        if(temp1<10)cout<<"0"<<temp1<<":";
        else cout<<temp1<<":";
        x=(int)x%3600;
    }
    else
        cout<<"00:";
    int temp2 = x/60;
    if(temp2!=0)
    {
        if(temp2<10)cout<<"0"<<temp2<<":";
        else cout<<temp2<<":";
        x=(int)x%60;
    }
    else
        cout<<"00:";
    if(x!=0)
    {
        if(x<10)cout<<"0"<<x;
        else cout<<x;
    }
    else
        cout<<"00";
    return 0;
}

你可能感兴趣的:(PAT乙级)