目录
题目一
- 题目一
- 题目二
简要描述:输入一个数,代表要检测的例子的个数,每个例子中:
输入两个时间(格式HH:MM:SS),前面时间减去后面时间,输出在时钟上显示的时间,格式一样,
如果是以为数字的前面补零。
#include
#include
#include
#include
using namespace std;
void TimeDiffer(){
//有n个例子
int n;
string t1,t2;
int h1,m1,s1,h2,m2,s2;
int h,m,s;
cin>>n;
while(n--){
cin>>t1>>t2;
//截取对应的时、分、秒
h1=atoi(t1.substr(0,2).c_str());
m1=atoi(t1.substr(3,2).c_str());
s1=atoi(t1.substr(6,2).c_str());
h2=atoi(t2.substr(0,2).c_str());
m2=atoi(t2.substr(3,2).c_str());
s2=atoi(t2.substr(6,2).c_str());
h=h1-h2;
m=m1-m2;
s=s1-s2;
if(s
关注
打赏