哥们你能试着理解一下我滴代码吗?
```
#include <iostream>
using namespace std;
int s, v, cnt, h, sum;
int main()
{
cin >> s >> v;
if(s % v == 0)
{
cnt =s / v;
}
else
{
cnt = s / v + 1;
}
cnt += 10;
if(cnt <= 60)
{
if(60 - cnt < 10)
{
cout << "07:0" << 60 - cnt;
}
else
{
cout << "07:" << 60 - cnt;
}
}
else
{
if(cnt % 60 == 0)
{
h = cnt / 60;
}
else
{
h = cnt / 60 + 1;
}
if((8 - h) < 0)
{
if(h % 8 == 0)
{
sum = h / 8;
}
else
{
sum = h / 8 + 1;
}
if(60 - cnt % 60 == 60)
{
cout << ((8 + sum * 24) - h) % 24+1 << ":00";
}
else
{
if(60 - (cnt % 60) < 10)
{
cout<< ((8 + sum * 24) - h) % 24 << ":0" << 60 - (cnt % 60);
}
else cout<< ((8 + sum * 24) - h) % 24 << ":" << 60 - (cnt % 60);
}
}
else
{
if(60 - (cnt % 60) < 10)
{
cout<< "0" << 8 - h << ":0" <<60 - (cnt % 60);
}
else
{
cout<< "0" << 8 - h << ":" << 60 - (cnt % 60);
}
}
}
return 0;
}
```
by XH_yyds @ 2023-04-24 22:24:49
虽然这样写复杂,但是思路上会变得很easy
by XH_yyds @ 2023-04-24 22:25:49
@[XH_yyds](/user/812752) 看的我麻麻的,没有注释没有优化,不见得思路easy...
by elong123 @ 2023-05-07 20:56:23
我大概看了一眼,如果时间太长了,超过了一天怎么办?
by XH_yyds @ 2023-05-08 17:47:30