美文网首页
PAT B1026 输出格式

PAT B1026 输出格式

作者: ranerr_ | 来源:发表于2019-07-14 19:13 被阅读0次
  1. 一定要注意时间类的数据的格式化输出
#include <cstdio>
#include <cmath>
using namespace std;
int main() {
  int c1, c2;
  scanf("%d%d", &c1, &c2);
  int d = round((0.0 + c2 - c1) / 100);
  int h = d / 3600;
  d %= 3600;
  int m = d / 60, s = d % 60;
  printf("%02d:%02d:%02d", h, m, s);
  return 0;
}

相关文章

网友评论

      本文标题:PAT B1026 输出格式

      本文链接:https://www.haomeiwen.com/subject/poyikctx.html