洛谷题解 AT2483 【合計時間 (Total Time)】

这题可以用数位分离的方法

(题目de链接)

先把分钟分离出来在分离秒,实现的代码如下

 

#include<iostream>
using namespace std;
int a,b,c,d,e,fen,miao;   //定义 
int main()
{
    cin>>a>>b>>c>>d;  //输入 
    e=a+b+c+d;   //e表示总秒数 
    miao=e%60;   //分离出秒数 
    fen=(e-miao)/60;   //分离出分钟 
    cout<<fen<<endl;   //输出 
    cout<<miao<<endl;   //记得要输出两行哦 
    return 0;   //结束 
}

 

 来了不如评个论哦

 

猜你喜欢

转载自www.cnblogs.com/wjm2006/p/11783140.html