p5757简洁,但90分,不知道哪里错了
  • 板块题目总版
  • 楼主jiuniea
  • 当前回复2
  • 已保存回复2
  • 发布时间2022/11/21 12:08
  • 上次更新2023/10/27 02:06:20
查看原帖
p5757简洁,但90分,不知道哪里错了
822502
jiuniea楼主2022/11/21 12:08

【深基2.例12】上学迟到

写的时候看过了其他人的题解

#include <stdio.h>
#include<string.h>


int  main()
{
		int t = 470, s, v;//倒着算
		scanf("%d %d", &s, &v);
		t = t - s / v;
		if (s % v != 0) {
			t--;
		}//如果不是整数就要提前一分钟去
		if (s / v > t) {
			t += 24 * 60;
		}
		if (t / 60 == 24) {
			printf("00:00");
		}//避免输出24:00
		else {
			printf("%02d:%02d", t / 60, t % 60);
		}
		return 0;
	}
2022/11/21 12:08
加载中...