308910: CF1594F. Ideal Farm

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Ideal Farm

题意翻译

Farmer John 有 $s$ 只奶牛,和 $n$ 个独立的篱笆,每个篱笆里可以圈养一些奶牛。出于一种奇♂️怪的偏好,Farmer John 把篱笆排成了一排。第 $i$ 个篱笆圈养的奶牛数量为 $a_i$,显然我们有 $\sum_{i=1}^n a_i=s$。而且,处于 Farmer John 的癖好,他要求对于每个 $i$ 都有 $a_i>0$。 Bessie 认为一个农场是“幸运的”当且仅当你可以找到一个区间 $[l,r]$,使得 $\sum_{i=l}^ra_i=k$。 而得寸进尺的 Bessie 认为一个农场是“牛逼的”当且仅当不管 Farmer John 怎么安置他的奶牛,该农场都是“幸运的”。 现在有 $t\,(1\le t\le 10^5)$ 组询问,每组询问给出 $s, n$ 和 $k\,(1\le s,n,k\le {10}^{18},\,n\le s)$,询问这个农场是不是“牛逼的”。

题目描述

Theofanis decided to visit his uncle's farm. There are $ s $ animals and $ n $ animal pens on the farm. For utility purpose, animal pens are constructed in one row. Uncle told Theofanis that a farm is lucky if you can distribute all animals in all pens in such a way that there are no empty pens and there is at least one continuous segment of pens that has exactly $ k $ animals in total. Moreover, a farm is ideal if it's lucky for any distribution without empty pens. Neither Theofanis nor his uncle knows if their farm is ideal or not. Can you help them to figure it out?

输入输出格式

输入格式


The first line contains a single integer $ t $ ( $ 1 \le t \le 10^5 $ ) — the number of test cases. The first and only line of each test case contains three integers $ s $ , $ n $ , and $ k $ ( $ 1 \le s, n, k \le 10^{18} $ ; $ n \le s $ ).

输出格式


For each test case, print YES (case-insensitive), if the farm is ideal, or NO (case-insensitive) otherwise.

输入输出样例

输入样例 #1

4
1 1 1
1 1 2
100 50 200
56220 47258 14497

输出样例 #1

YES
NO
NO
YES

说明

For the first and the second test case, the only possible combination is $ [1] $ so there always will be a subsegment with $ 1 $ animal but not with $ 2 $ animals.

Input

题意翻译

Farmer John 有 $s$ 只奶牛,和 $n$ 个独立的篱笆,每个篱笆里可以圈养一些奶牛。出于一种奇♂️怪的偏好,Farmer John 把篱笆排成了一排。第 $i$ 个篱笆圈养的奶牛数量为 $a_i$,显然我们有 $\sum_{i=1}^n a_i=s$。而且,处于 Farmer John 的癖好,他要求对于每个 $i$ 都有 $a_i>0$。 Bessie 认为一个农场是“幸运的”当且仅当你可以找到一个区间 $[l,r]$,使得 $\sum_{i=l}^ra_i=k$。 而得寸进尺的 Bessie 认为一个农场是“牛逼的”当且仅当不管 Farmer John 怎么安置他的奶牛,该农场都是“幸运的”。 现在有 $t\,(1\le t\le 10^5)$ 组询问,每组询问给出 $s, n$ 和 $k\,(1\le s,n,k\le {10}^{18},\,n\le s)$,询问这个农场是不是“牛逼的”。

加入题单

算法标签: