Undertakers @ 2024-10-01 17:57:26
#include<stdio.h>
int main()
{
double s,v;
scanf("%lf %lf",&s,&v);
int t=s/v+10;
int a,b,c,d;
a=t/60;
b=t%60;
c=7-a;
if(b!=0){d=59-b;}
else d=60-b;
if(c>=0)
{if(d<10){
printf("0%d:0%d",c,d);
}
else printf("0%d:%d",c,d);
}
if(c<0){
c+=24;
if(c>=10){
if(d<10){
printf("%d:0%d",c,d);
}
else printf("%d:%d",c,d);
}
else
if(d<10){
printf("0%d:0%d",c,d);
}
else printf("0%d:%d",c,d);
}
return 0;
}
by YOU_QAQ_xiaohao @ 2024-10-01 18:03:22
AC代码
#include <bits/stdc++.h>
using namespace std;
int s, v, m = 470;
int main(){
cin >> s >> v;
if(s % v == 0){
m -= (s / v);
}
else{
m -= (s / v + 1);
}
if(m < 0){
m = 1440 + m;
}
if(m / 60 <= 9){
cout << 0;
}
cout << m / 60 << ":";
if(m % 60 <= 9){
cout << 0;
}
cout << m % 60;
return 0;
}
@Undertakers 求关注
by SQH2004 @ 2024-10-01 20:15:29
@Undertakers s/v不为整数的情况是不是没考虑,int t的话会略去小数部分吧,这样时间是不是应该加一