返回 课程
信奥AC之路-1级
0% 完成
0/0 步骤
-
第1课 开发环境与基础输出5 主题|小节
-
第2课 算术运算符7 主题|小节
-
第3课 printf与运算输出7 主题|小节
-
第4课 数的进制与拆位6 主题|小节
-
第5课 变量与基础运算17 主题|小节
-
第6课 常量与取整运算8 主题|小节
-
第7课 关系运算8 主题|小节
-
第8课 逻辑运算9 主题|小节
-
第9课 输入与计算进阶10 主题|小节
-
第10课 if语句及双分支语句8 主题|小节
-
第11课 if语句及双分支进阶11 主题|小节
-
第12课 三目运算9 主题|小节
-
第13课 多分支、多if和switch语句11 主题|小节
-
第14课 循环(基本输出)7 主题|小节
-
第15课 循环(While+If)8 主题|小节
-
第16课 循环(计数、求和、求乘积)10 主题|小节
-
第17课 循环进阶(While+)8 主题|小节
-
第18课 do-while及while其他用法8 主题|小节
-
第19课 For循环基础9 主题|小节
-
第20课 For循环进阶8 主题|小节
课 进展
0% 完成
// 综合运用时间计算和取整
int students, capacity, start_hour, start_minute;
scanf("%d%d%d:%d", &students, &capacity, &start_hour, &start_minute);
// 计算需要的批次(向上取整)
int batches = (students + capacity - 1) / capacity;
// 每批需要的时间(分钟)
int time_per_batch = 45;
// 计算总共需要的时间
int total_minutes = batches * time_per_batch;
// 计算结束时间
int start_in_minutes = start_hour * 60 + start_minute;
int end_in_minutes = (start_in_minutes + total_minutes) % (24 * 60);
// 转换为时分格式
int end_hour = end_in_minutes / 60;
int end_minute = end_in_minutes % 60;
printf("%d:%dn", end_hour, end_minute);