C++ 0分求助(菜)

P5707 【深基2.例12】上学迟到

在小时前面加个0
by qqww1234 @ 2023-03-26 07:03:25


更新一下30分代码(笑) ```c #include<bits/stdc++.h> using namespace std; int main() { int t,h,m; double s,v,t1,t2; cin>>s>>v; t1=s/v; t=t1; t2=t; if(t1>t2) { t+=1; } t+=10; if(t<60) { if(60-t<10) cout<<"07:0"<<60-t; else cout<<"07:"<<60-t; } else if(60<=t<480) { if(t%60==0) { cout<<"0"<<8-t/60<<":00"; return 0; } h=t/60; m=t-h*60; cout<<8-m-1<<":"<<60-m; } else { if(t==480) { cout<<"00:00"; } else { if(t%60==0) { h=t/60; if(24-h<10) { cout<<"0"<<24-h<<":00"; } else { cout<<24-h<<":00"; } return 0; } h=t/60; m=t-h*60; h=h-8; if(24-h>=10) if(60-m>=10) cout<<24-h-1<<":"<<60-m; else cout<<24-h-1<<":0"<<60-m; else cout<<"0"<<24-h-1<<":0"<<60-m; } } return 0; } ```
by 低调君qwq @ 2023-03-26 07:08:22


@[qqww1234](/user/770357) 蓝名大佬帮忙看看新代码呗qwq
by 低调君qwq @ 2023-03-26 07:09:44


又变70分了... ```c #include<bits/stdc++.h> using namespace std; int main() { int t,h,m; double s,v,t1,t2; cin>>s>>v; t1=s/v; t=t1; t2=t; if(t1>t2) { t+=1; } t+=10; if(t<60) { if(60-t<10) cout<<"07:0"<<60-t; else cout<<"07:"<<60-t; } else if(60<=t<480) { if(t%60==0) { cout<<"0"<<8-t/60<<":00"; return 0; } h=t/60; m=t-h*60; if(60-m>=10) cout<<"0"<<8-h-1<<":"<<60-m; else cout<<"0"<<8-h-1<<":0"<<60-m; } else { if(t==480) { cout<<"00:00"; } else { if(t%60==0) { h=t/60; if(24-h<10) { cout<<"0"<<24-h<<":00"; } else { cout<<24-h<<":00"; } return 0; } h=t/60; m=t-h*60; h=h-8; if(24-h>=10) if(60-m>=10) cout<<24-h-1<<":"<<60-m; else cout<<24-h-1<<":0"<<60-m; else cout<<"0"<<24-h-1<<":0"<<60-m; } } return 0; } ```
by 低调君qwq @ 2023-03-26 07:18:05


``` if(60<=t<480) ``` 这一条语句有语法错误,应该是 ``` if(60<=t&&t<480) ```
by _XiaY_ @ 2023-03-26 07:33:03


@[_XiaY_](/user/475783) 感谢感谢 好久没碰Devcpp了 这些东西都忘了awa
by 低调君qwq @ 2023-03-26 07:37:44


@[_XiaY_](/user/475783) 把这个改了立马全AC了hhhhh
by 低调君qwq @ 2023-03-26 07:39:51


|