https://codeforces.com/problemset/problem/1256/A
思路:m = s / n,先判断一下需要几枚 n 元硬币,然后如果 a>=m,那么就判断一下 b>=s%n;
如果 a<m,s -= a*n,然后判断 b>=s
#include<iostream>
using namespace std;
void solved()
{
int a,b,n,s;
cin>>a>>b>>n>>s;
int m=s/n;
if(a>=m)
{
if(b>=s%n) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
else
{
s-=a*n;
if(b>=s) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t;
cin>>t;
while(t--)
{
solved();
}
return 0;
}