PAT (Basic Level) 1026 程序运行时间

题意

给定C1、C2,将C2 - C1转时间表示(要四舍五入到整数)。

思路

水~

代码

#include <bits/stdc++.h>
using namespace std;
int main() {
	//ios::sync_with_stdio(false);
	//cin.tie(nullptr);
	//cout.tie(nullptr);
	int c1, c2;
	scanf("%d %d", &c1, &c2);
	int dis = c2 - c1;
	int t = (int)( dis / 100.0 + 0.5);
	printf("%02d:%02d:%02d\n", t / 3600, t % 3600 / 60, t % 60);
	return 0;
} 	 

HINT

不定时更新更多题解,Basic Level 全部AC代码,详见 link ! ! !

发布了31 篇原创文章 · 获赞 15 · 访问量 755

猜你喜欢

转载自blog.csdn.net/abcdefbrhdb/article/details/104565250