JIUZHOU1 @ 2023-11-21 12:08:23
#include <stdio.h>
int main(){
int s,v;
int t3;
int m3,t1,m;
int m1,m2=480,mm=1440; //m1为去学校的时间,m2为8:00
scanf("%d %d",&s,&v);
t3=s%v;
if(t3==0){
m1=10+s/v;
}else{
m1=11+s/v;
}
if(m2-m1>=0){
m3=m2-m1;
t1=m3/60;
m=m3-t1*60;
if(m>=0&&m<10){
printf("0%d:0%d",t1,m);
}else if(m>=10){
printf("0%d:%d",t1,m);
}
}else if(m2-m1<0){
m3=m1-m2;
t1=(mm-m3)/60;
m=(mm-m3)%60;
if(t1>=0&&t1<10){
if(m>=0&&m<10){
printf("0%d:0%d",t1,m);
}else if(m>=10){
printf("0%d:%d",t1,m);
}
}else if(t1>10){
if(m>=0&&m<10){
printf("%d:0%d",t1,m);
}else if(m>=10&&m<60){
printf("%d:%d",t1,m);
}
else if(m>=60&&m<70){
printf("%d:%d",t1,m);
}
else if(m>=70){
printf("%d:%d",t1,m);
}
}
}
}
by XDmzj @ 2023-11-25 20:35:48
#include <stdio.h>
int main()
{
int s = 0;
int v = 0;
scanf("%d %d", &s, &v);
//1440+480
int time = 0;
if (s % v == 0)
time = s / v + 10;
else
time = s / v + 1 + 10;
if (time <= 480)
{
int h = time / 60;
int c = time % 60;
if (c == 0)
printf("%02d:00 ", 7 - h + 1);
else
printf("%02d:%02d", 7 - h, 60 - c);
}
else
{
time = time - 480;
int h = time / 60;
int c = time % 60;
if (c == 0)
printf("%02d:00 ", 23 - h + 1);
else
printf("%02d:%02d", 23 - h, 60 - c);
}
return 0;
}
by XDmzj @ 2023-11-25 20:37:15
我也是纯c(抱抱),这道题到处是坑,你要想想极端的例子,比如说,479、480、1000等
by JIUZHOU1 @ 2023-12-03 20:17:32
@XDmzj 谢谢