题解
_Separation · · 题解
翻译已上传,具体题意看翻译:
- 解题思路:
*-假设当前时间为要发送一条短信,有两种策略:1、关机等,到时间打开,那么消耗电量为 ,不关机,待机等待,那么消耗电量为 ${m_i - time a}或以下了那么就失败了。(PS:记得开 long long)**
#include <iostream>
#define endl '\n'
using namespace std;
void solve(){
long long n, f, a, b;
cin >> n >> f >> a >> b;
int time = 0;
while (n--){
int m; cin >> m;
f -= min(b, a * (m - time));
time = m;
}
cout << (f > 0 ? "YES" : "NO") << endl;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t; cin >> t;
while (t--) solve();
return 0;
}