求救!40分!求大佬们指教
查看原帖
求救!40分!求大佬们指教
952427
lishiyu2013楼主2023/8/18 21:20
#include<bits/stdc++.h>
using namespace std;
int main() {
	int s,v0,v1,t1,v2,t2;
	int pos=0,now_time=0,n;
	scanf("%d%d%d%d%d%d",&s,&v0,&v1,&t1,&v2,&t2);
	scanf("%d",&n);
	int v=v1-v2,t=t1-t2;
	while(n--) {
		int TT;
		scanf("%d",&TT);
		long long next_pos=pos+1ll*v0*(TT-now_time);
		if(next_pos>=s) {
			long long rest_dist=s-pos;
			int rest_time=ceil(rest_dist/v0);
			now_time+=rest_time;
			pos=s;
			break;
		}
		pos=next_pos;
		v+=v2;
		t+t2;
		now_time=TT+t;
		pos-=1ll*v*t;
		if(pos<0) pos=0;
	}
	if(pos<s) {
		long long rest_dist=s-pos;
		int rest_time=ceil(rest_dist/v0);
		now_time+=rest_time;
	}
	int d=now_time/86400+1;
	now_time%=86400;
	int hr=now_time/3600;
	now_time%=3600;
	int mi=now_time/60;
	now_time%=60;
	printf("202304%02dat%02d:%02d:%02d",d,hr,mi,now_time);
	return 0;
} 
2023/8/18 21:20
加载中...