求助,第二个输入死活解不出来
查看原帖
求助,第二个输入死活解不出来
1132339
SIRIUS0105楼主2023/11/28 23:29

B3768 [语言月赛202305] 独行``` #include<bits/stdc++.h> using namespace std; int main() { int s, v0, v1, t1, v2, t2; cin >> s >> v0 >> v1 >> t1 >> v2 >> t2;

int n;
cin >> n;

int npos = 0;
int ntime = 0;
for(int i=0;i<n;i++)
{
	int t;
	int time;
	cin >> t;
	t = t-ntime;
	time = (s-npos) / v0;
	if(time<t)
	{
		npos = s;
		ntime+=t;
		break;
	}
	else
	{
		npos = npos+v0*t;
		ntime+=t;
	}
	int temp;
	temp = (v1+v2*i)*(t1+t2*i);
	npos = npos - temp;
	if(npos<0)
	{
		npos = 0;
	}
	ntime+=t1+t2*i;
}
ntime = ceil(ntime + 1.0*(s-npos)/v0);

int nday, nhour, nminute, nsecond;
if(ntime>=3600*24*30)
{
	nday  = 30;
	nhour = 23;
	nminute = 59;
	nsecond = 59;
	
}
else
{
	nsecond = ntime%60;
	nminute = (ntime%3600)/60;
	nhour   = (ntime%86400)/3600;
	nday    = ntime/86400+1;
}
printf("202304%02dat%02d:%02d:%02d\n", nday, nhour, nminute, nsecond);
return 0;

}

2023/11/28 23:29
加载中...