X_kengdada @ 2023-08-29 14:35:26
#include <stdio.h>
#include <stdlib.h>
int main()
{
int s,v,n,h,m,l;
scanf("%d %d",&s,&v);
n = (s/v)+10;
if(n<480)
{
if(s/v%60 != 0)
{
l = 480-n-1;
}
else
{
l = 480 -n;
}
}
else
{
if(s/v%60 != 0)
{
l = 1920-n-1;
}
else
{
l = 1920 -n;
}
}
h = l/60;
m = l%60;
if(h<10&&m<10)
{
printf("0%d:0%d",h,m);
}
else if(h<10&&m>=10)
{
printf("0%d:%d",h,m);
}
else if(h>=10&&m<10)
{
printf("%d:0%d",h,m);
}
else if(h>=10&&m>=10)
{
printf("%d:%d",h,m);
}
return 0;
}
by Szy0720 @ 2023-08-29 15:04:14
@X_kengdada 向上取整
by Szy0720 @ 2023-08-29 15:11:18
#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;
}