shiyizi @ 2024-11-26 15:10:04
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
int s,v,min;
cin >> s >> v;
if (s % v != 0)
{
min = 11 + s / v;
}
else
{
min = 10 + s / v;
}
if (min <= 480)
{
if (min % 60 == 0)
{
cout << "0" << 8 - min / 60 << ":00" << endl;
}
else
{
cout << "0" << 7 - min / 60 << ":" << 60 - min % 60 << endl;
}
}
else if (min > 480 && min<=1320)
{
if (min % 60 == 0)
{
cout << 24 - (min - 480) / 60 << ":00" << endl;
}
else
{
cout << 23 - (min - 480) / 60 << ":" << 60 - (min - 480) % 60 << endl;
}
}
else
{
if (min % 60 == 0)
{
cout << "0" << 24 - (min - 480) / 60 << ":00" << endl;
}
else
{
cout << "0" << 23 - (min - 480) / 60 << ":" << 60 - (min - 480) % 60 << endl;
}
}
return 0;
}
80分求助
by EVA0 @ 2024-11-29 19:32:53
#include <cstdio>
int main()
{
int S;//家到学校的距离
int V;//行走的速度
scanf("%d%d",&S,&V);
int t;
if(S%V==0)//因为后面是从07:59开始的,所以这里的时间少一分钟
{
t=S/V;
t+=9;//垃圾分类的时间
}
else
{
t=S/V;//时间如果不能被速度整除,就要提前一分钟出发
t+=10;//垃圾分类的时间
}
int H;//保存出发的小时,分钟
int M;
H=7;
M=59;
while(t!=0)
{
if(M!=0)
{
M--;
}
else
{
if(H!=0)
{
H--;
M=59;
}
else
{
H=23;
M=59;
}
}
t--;
}
int h1,h2;//分开保存小时,分钟的十位,个位
int m1,m2;
h1=H/10;
h2=H-(10*(H/10));
m1=M/10;
m2=M-(10*(M/10));
printf("%d%d:%d%d",h1,h2,m1,m2);
}
by BH9570 @ 2024-11-29 21:12:28
希望你能看懂
#include<bits/stdc++.h>
using namespace std;
int main () {
int s,u;
int minute = 0;
int hour = 0;
cin >> s >> u;
int time = s / u;
if (time * u != s) {
time++;
}
hour = time / 60;
minute = time % 60;
if (minute > 50) {
minute -= 50;
hour++;
minute = 60 - minute;
}
else {
minute = 50 - minute;
}
if (hour > 7) {
hour -= 7;
hour = 24 - hour;
}
else {
hour = 7 - hour;
}
if (hour < 10) {
cout << "0";
}
cout << hour << ":";
if (minute < 10) {
cout << "0";
}
cout << minute << endl;
return 0;
}
@shiyizi