50分求助!(赏关一个)

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

要加一个ceil向上取整~~虽然也是错的~~
by wyxrl @ 2024-03-04 21:07:08


``` #include<bits/stdc++.h> using namespace std; int cnt=8*60+24*60,s,u,num,fen,shi; int main(){ cin>>s>>u; num=ceil(s/u)+10;//ceil的意思是向上取整,因为C++默认向下取整; cnt=cnt-num; if(cnt>=24*60){ cnt-=24*60; shi=cnt/60; fen=cnt%60; } if(shi<10){ if(fen%60==0){ cout<<"0"<<shi<<":"<<fen; } else{ cout<<"0"<<shi<<":"<<fen-1; } } else{ if(fen%60==0){ cout<<shi<<":"<<fen; } else{ cout<<shi<<":"<<fen-1; } } return 0; } ``` 经过朋友指导变成了这样
by zzh0118 @ 2024-03-04 21:11:49


@[wyxrl](/user/1266960)
by zzh0118 @ 2024-03-04 21:12:36


还是50分
by zzh0118 @ 2024-03-04 21:14:32


@[lutaoquan2012](/user/952033)
by zzh0118 @ 2024-03-04 21:15:02


@[zzh0118](/user/1016479) 来喽
by lutaoquan2012 @ 2024-03-04 21:21:13


```cpp #include<bits/stdc++.h> using namespace std; int cnt=8*60+24*60,s,u,num,fen,shi; int main(){ cin>>s>>u; num=ceil(s/u)+10;//ceil的意思是向上取整,因为C++默认向下取整; cnt=cnt-num; if(cnt>=24*60){ cnt-=24*60; shi=cnt/60; fen=cnt%60; } if(shi<10){ if(fen<10){ cout<<"0"<<shi<<":0"<<fen; } else{ cout<<"0"<<shi<<":"<<fen; } } else{ if(fen<10){ cout<<shi<<":0"<<fen; } else{ cout<<shi<<":"<<fen; } } return 0; } ``` 第三稿
by zzh0118 @ 2024-03-04 21:25:48


```cpp #include<bits/stdc++.h> using namespace std; int cnt=8*60+24*60,s,u,num,fen,shi; int main(){ cin>>s>>u; num=ceil(s/u)+10;//ceil的意思是向上取整,因为C++默认向下取整; cnt=cnt-num; if(cnt>=24*60){ cnt-=24*60; shi=cnt/60; fen=cnt%60; } if(shi<10){ if(fen<10){ if(fen%60==0){ cout<<"0"<<shi<<":0"<<fen; } else{ cout<<"0"<<shi<<":0"<<fen-1; } } else{ if(fen%60==0){ cout<<"0"<<shi<<":"<<fen; } else{ cout<<"0"<<shi<<":"<<fen-1; } } } else{ if(fen<10){ if(fen%60==0){ cout<<shi<<":0"<<fen; } else{ cout<<shi<<":0"<<fen-1; } } else{ if(fen%60==0){ cout<<shi<<":"<<fen; } else{ cout<<shi<<":"<<fen-1; } } } return 0; } ``` 现在70了
by zzh0118 @ 2024-03-04 21:30:54


```cpp #include<bits/stdc++.h> using namespace std; int cnt=8*60+24*60,s,u,num,fen,shi; int main(){ cin>>s>>u; num=ceil(s/u)+10;//ceil的意思是向上取整,因为C++默认向下取整; cnt=cnt-num; if(cnt>=24*60){ cnt-=24*60; } shi=cnt/60; fen=cnt%60; if(shi<10){ if(fen<10){ if(fen%60==0){ cout<<"0"<<shi<<":0"<<fen; } else{ cout<<"0"<<shi<<":0"<<fen-1; } } else{ if(fen%60==0){ cout<<"0"<<shi<<":"<<fen; } else{ cout<<"0"<<shi<<":"<<fen-1; } } } else{ if(fen<10){ if(fen%60==0){ cout<<shi<<":0"<<fen; } else{ cout<<shi<<":0"<<fen-1; } } else{ if(fen%60==0){ cout<<shi<<":"<<fen; } else{ cout<<shi<<":"<<fen-1; } } } return 0; } ``` 第四稿90分了
by zzh0118 @ 2024-03-04 21:35:13


@[zzh0118](/user/1016479) 我来了
by 2345A @ 2024-03-05 10:18:40


| 下一页