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

Unleash the Flexbox

For those interested in those leadership positions.

Preparing for Google Cloud Professional Cloud Architect Certification — Dec 2021

What is ASP .Net Core? An Introduction to the New Framework

Vehicle mode for FPS games with Godot Engine

Creating “.exe” Executable Setup for Flutter Desktop Apps — Windows 💻

Build On, ASEAN 2021

Build On, ASEAN 2021 Logo

I will convert xd to html css bootstrap5 responsive figma, zeplin, pdf to html website

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

𝐁𝐢𝐧𝐚𝐫𝐲 𝐒𝐞𝐚𝐫𝐜𝐡 𝐈𝐧 𝐎𝐧𝐞 𝐅𝐫𝐚𝐦𝐞

How to solve the “Fibonacci Number modulo M” Problem in Java

Fibonacci numbers

What is Reactive Programming? | Interview basics

Coding Standard in Java