WA 70point
查看原帖
WA 70point
564225
dontwannacry楼主2022/9/23 20:03
#include<bits/stdc++.h>
using namespace std;
long long n,x,p,q,t[100010],ti,tin,d,ls;
int main() {
	ios::sync_with_stdio(false);
	cin >> n >> x >> p >> q;
	int i;
	for(i = 1;i <= n;++i){
		cin >> t[i];
	}
	i = 1;
	while(1){
		++d;
		ti += x;
		tin = (x*p*d-1)/q+1;
		ls = x;
		while(i <= n&&ti-t[i]>=tin&&ls-t[i]>0){
			ti -= t[i];
			ls -= t[i];
			++i;
		}
		if(i > n){
			break;
		}
	}
	cout << d;
	return 0;
}
2022/9/23 20:03
加载中...