社区讨论

80分,蒟蒻求助

P5707【深基2.例12】上学迟到参与者 3已保存回复 3

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
3 条
当前快照
1 份
快照标识符
@lo91toe0
此快照首次捕获于
2023/10/28 04:11
2 年前
此快照最后确认于
2023/10/28 04:11
2 年前
查看原帖
CPP
#include<bits/stdc++.h>
using namespace std;
int s,v;
int main(){
	cin>>s>>v;
	if(s%v!=0){
		int ans=s/v;
		int temp=ans/60;
		ans%=60;
		if(temp<8){
			int h=7,m=60;
			h-=temp;
			m-=ans;
			if(m-10<10)cout<<"0"<<h<<":0"<<m-11;
			else cout<<"0"<<h<<":"<<m-11;	
		}else{
			int h=31,m=60;
			h-=temp;
			m-=ans;
			if(h<10)cout<<"0"<<h;
			else cout<<h;
			cout<<":";
			if(m-10<10)cout<<"0"<<m-10-11;
			else cout<<m-11;
		}	
	}else{
		int ans=s/v;
		int temp=ans/60;
		ans%=60;
		if(temp<8){
			int h=7,m=60;
			h-=temp;
			m-=ans;
			if(m-10<10)cout<<"0"<<h<<":0"<<m-10;
			else cout<<"0"<<h<<":"<<m-10;	
		}else{
			int h=31,m=60;
			h-=temp;
			m-=ans;
			if(h<10)cout<<"0"<<h;
			else cout<<h;
			cout<<":";
			if(m-10<10)cout<<"0"<<m-10-10;
			else cout<<m-10;
		}	
	}
	
	return 0;
}

回复

3 条回复,欢迎继续交流。

正在加载回复...