CF1256A.Payment Without Change

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You have aa coins of value nn and bb coins of value 11 . You always pay in exact change, so you want to know if there exist such xx and yy that if you take xx ( 0xa0 \le x \le a ) coins of value nn and yy ( 0yb0 \le y \le b ) coins of value 11 , then the total value of taken coins will be SS .

You have to answer qq independent test cases.

输入格式

The first line of the input contains one integer qq ( 1q1041 \le q \le 10^4 ) — the number of test cases. Then qq test cases follow.

The only line of the test case contains four integers aa , bb , nn and SS ( 1a,b,n,S1091 \le a, b, n, S \le 10^9 ) — the number of coins of value nn , the number of coins of value 11 , the value nn and the required total value.

输出格式

For the ii -th test case print the answer on it — YES (without quotes) if there exist such xx and yy that if you take xx coins of value nn and yy coins of value 11 , then the total value of taken coins will be SS , and NO otherwise.

You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).

输入输出样例

  • 输入#1

    4
    1 2 3 4
    1 2 3 6
    5 2 6 27
    3 3 5 18
    

    输出#1

    YES
    NO
    NO
    YES
    
首页