zznzky @ 2024-12-02 12:24:00
=
#include<stdio.h>
int main()
{ int shi,fen;
int s,v,t;
scanf("%d %d",&s,&v);
t=s/v;
if(s%v!=0){
t++;}
if(t>470)
{
shi=23-(t-470)/60;
}else{
shi=7-(t-50)/60;
}
if(t%60>50)
{
fen=60-(t%60-50);
}if(t%60<=50){
fen=50-t%60;
}if(shi<10&&fen>=10){
printf("0%d:%d",shi,fen);
}if(shi<10&&fen<10){
printf("0%d:0%d",shi,fen);}
if(shi>=10&&fen<10){
printf("%d:0%d",shi,fen);
}if(shi>=10&&fen>=10){
printf("%d:%d",shi,fen);
}
return 0;
}
by pjh0625 @ 2024-12-02 12:31:50
@zznzky
#include<bits/stdc++.h>
using namespace std;
double s,v,m;
int n,a,t,b;
int main()
{
cin>>s>>v;
n=8*60+24*60;
t=ceil(s/v)+10;//ceil()
n=n-t;
if(n>=24*60) n-=24*60;
b=n%60;
a=n/60;
if(a<10)
{
if(b<10) cout<<"0"<<a<<":0"<<b;
else cout<<"0"<<a<<":"<<b;
}
else
{
if(b<10) cout<<a<<":0"<<b;
else cout<<a<<":"<<b;
}
return 0;
}
虽然我用C++写的。。。
by zznzky @ 2024-12-02 17:29:27
@pjh0625c++的代码我看不懂,哭
by pjh0625 @ 2024-12-02 21:59:07
@zznzky
#include <stdio.h>
#include <math.h>
int main() {
double s, v;
int n, a, t, b;
scanf("%lf %lf", &s, &v);
n = 8 * 60 + 24 * 60;
t = ceil(s / v) + 10;
n = n - t;
if (n >= 24 * 60) n -= 24 * 60;
b = n % 60;
a = n / 60;
if (a < 10) {
if (b < 10) printf("0%d:0%d", a, b);
else printf("0%d:%d", a, b);
} else {
if (b < 10) printf("%d:0%d", a, b);
else printf("%d:%d", a, b);
}
return 0;
}
唉,稍微转了一下
by zznzky @ 2024-12-05 12:55:10
@pjh0625超级感谢!