P5707上学迟到50分代码,求助
查看原帖
P5707上学迟到50分代码,求助
379732
深度产业观察楼主2021/5/26 18:54

很离谱,已经傻了

#include<bits/stdc++.h>
using namespace std;
int s,v,t,z,ts,zs;
int main(){
	cin>>s>>v;
	z=s/v;
	if(s%v!=0)
		z+=1;
	if(z%60==0)
		t=z/60;
	else
		t=z/60+1;
	ts=8-t;
	zs=60-z-10;
	if(ts<0)
		ts=8-t+24;
	if(zs<0){
		/*
		if(z%60==0)
			ts-=z/60;//*
		else
			ts-=z/60+1;
		*/
		zs=60-z-10+60*(z/60);
	}
	if(zs==60 and zs!=0){
		zs=0;
		ts+=1;
	}
	if(ts%10>=0 and ts>10)
		cout<<ts<<":"<<zs;
	if(ts<=10 and zs!=0)
		cout<<"0"<<ts<<":"<<zs;
	if(ts<=10 and zs==0)
		cout<<"0"<<ts<<":"<<"0"<<zs;
	if(ts%10>=0 and ts>10 and zs==0)
		cout<<ts<<":"<<"0"<<zs;
}

/*
s=300
v=6
z=50
t=1
*/
2021/5/26 18:54
加载中...