Golf (LKDNGOLF) Solution — Codechef May Long Challenge

Input

  • The first line contains an integer T, the number of test cases. Then the test cases follow.
  • The only line of each test case contains three integers N,x,k.

Output

Constraints

  • 1≤T≤10⁵
  • 1≤x,k≤N≤10⁹

Subtasks

Sample Input

3
5 4 2
5 3 2
5 5 2

Sample Output

YES
NO
NO

Explanation

import java.util.*;import java.lang.*;import java.io.*;/* Name of the class has to be "Main" only if the class is public. */class Codechef{public static void main (String[] args) throws java.lang.Exception{// your code goes hereBufferedReader br = new BufferedReader(new InputStreamReader(System.in));int t = Integer.parseInt(br.readLine());while(t-- > 0){String str[] = br.readLine().split(" ");int n = Integer.parseInt(str[0]);int x = Integer.parseInt(str[1]);int k = Integer.parseInt(str[2]);int s = (n+1)%k;if((x%k)==0 || (x%k)==s)System.out.println("YES");elseSystem.out.println("NO");}}}

--

--

--

Software Developer ,currently pursuing B.Tech in Information Technology. Electronic Dance Music is love.Also like all phone related technologies

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

GSoC 2020 Back With OpenMRS

Algorithm

Getting Started with Android things, Lesson 1: Blinking LED

Threads, Processes, Parallelism, and Concurrency in Python

Getting AWS Solutions Architect & Developer Associate

On the performance of Pipelined Hotstuff

New Fund Research for Office Cloud

Offshore apps management tips from successful software companies

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Anubhav Mishra

Anubhav Mishra

Software Developer ,currently pursuing B.Tech in Information Technology. Electronic Dance Music is love.Also like all phone related technologies

More from Medium

Java 學習記錄109 — Introduction to SQLite

Why Learn Java in 2021

The diamond problem in java is coming due to multiple inheritances.

VERY Basic Differences Between Java and JavaScript-Arrays