B. [R16B]两个按钮

    Type: Default 1000ms 512MiB

[R16B]两个按钮

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

时空限制

1S/512M

题目描述

有两个按钮:AA 按钮按一次得 aa 分,BB 按钮按一次得 bb 分。

初始分数为 00,求是否存在按恰好 nn 次按钮后总得分为 kk 的可能性。

共有 TT 组数据。

格式

输入格式

第一行包含一个整数 TT,表示数据的组数。

对于每组数据:

第一行包含四个整数 a,b,n,ka,b,n,k,含义与题目描述相同。

输出格式

对于每组数据,在单独的一行中输出字符串表示答案,如果存在按恰好 nn 次按钮后总得分为 kk 的可能性输出 YES,否则输出 NO

样例

样例输入 #1

3
1 10 4 31
1 10 4 30
10 1 4 40

样例输出 #1

YES
NO
YES

样例解释 #1

对于第 11 组数据,按 11AA 按钮,按 33BB 按钮,总得分为 1×1+10×3=311\times 1+10\times 3=31

对于第 22 组数据,不存在按恰好 44 次按钮后总得分为 3030 的可能性。

对于第 33 组数据,按 44AA 按钮,总得分为 10×4=4010\times 4=40

数据规模

对于 100%100\% 的数据,1T10001\leq T\leq 10001a,b10001\leq a,b\leq 10001n10001\leq n\leq 10001k1061\leq k\leq 10^6

代码源挑战赛 Round 16

Not Attended
Status
Done
Rule
DMY
Problem
6
Start at
2025-6-13 20:00
End at
2025-6-13 21:30
Duration
1.5 hour(s)
Host
Partic.
507