70分求助,不懂哪出错了
查看原帖
70分求助,不懂哪出错了
1543649
airshy楼主2025/1/26 17:05
#include<stdio.h>
#include<math.h>
	//计算时间,遇到多余时间加一
	//计算8点前减多少,遇见负数变成24—
	//输出时间
	int main() {
		int s, v, t, m, h;
		scanf("%d %d", &s, &v);
		if (s / v == 0) {
			t = s / v;
		}
		else {
			t = s / v + 1;
		}
		t += 10;
		h = (8 * 60 - t) / 60;
		if(h > 0) {
			m = (8 * 60 - t) % 60;
		}
		else if (h <= 0) {
			h = 24 + h;
			m = -(8 * 60 - t) % 60;
		}
		
		printf("%02d:%02d", h, m);
		
		return 0;

	}
	
2025/1/26 17:05
加载中...