只有测试点8,9,10WA,请各位指点迷津
代码
#include<iostream>
using namespace std;
int main() {
unsigned int s, v,t2,t3,t4;//初始化s和v,t2是出发时间,t3是小时,t4是分钟
cin >> s >> v;
double t = double(s) / v;
if (t != int(t)) { t = int(t) + 11; }
else { t = t + 10; }//花费时间
t2 = 8 * 60 - t;
if (t2 < 0) { t2 = 24 * 60 + t2; }
t3 = t2 / 60;
t4 = t2%60;
printf("%02d:%02d", t3, t4);
return 0;
}
#include<iostream>
using namespace std;
int main() {
unsigned int s, v,t2,t3,t4;//初始化s和v,t2是出发时间,t3是小时,t4是分钟
cin >> s >> v;
double t = double(s) / v;
if (t != int(t)) { t = int(t) + 11; }
else { t = t + 10; }//花费时间
t2 = 8 * 60 - t;
if (t2 < 0) { t2 = 24 * 60 + t2; }
t3 = t2 / 60;
t4 = t2%60;
printf("%02d:%02d", t3, t4);
return 0;
}