LHX_18460366315 @ 2023-12-29 19:03:26
70分,8/9/10三个点出错,求助呜呜呜呜呜······
帮我改亿下:
#include<bits/stdc++.h>
using namespace std;
int main(){
int s,v,hour = 0,min = 470;
float time = 0;
cin >> s >> v;
time = s / v;
if (time > int(time)){
min -= (int(time) + 1);
}else{
min -= (int(time) + 1);
}
hour = min / 60;
min %= 60;
cout << 0 << hour << ":";
if (min < 10){
cout << 0 << min;
}else{
cout << min;
}
}
by newbie666 @ 2023-12-29 19:24:43
你不能把取模拆开,这样会错
by newbie666 @ 2023-12-29 19:25:47
@ZZYX_18670145320
#include<bits/stdc++.h>
using namespace std;
int main(){
int s,v,hour = 0,min = 470;
int time = 0;
cin >> s >> v;
time = s / v;
if(s%v)time++;
min=(3350-time)%1440;
hour = min / 60;
min %= 60;
if(hour<10)cout << 0 << hour << ":";
else cout<<hour<<":";
if (min < 10){
cout << 0 << min;
}else{
cout << min;
}
}
这个才能A
by LHX_18460366315 @ 2023-12-30 18:59:44
@inaoui 谢谢,已过