AtCoder Beginner Contest 165 - We Love Golf

Takahashi the Jumbo will practice golf.
His objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).
If he can achieve the objective, print OK; if he cannot, print NG.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq A \leq B \leq 1000
 - 1 \leq K \leq 1000

-----Input-----
Input is given from Standard Input in the following format:
K
A B

-----Output-----
If he can achieve the objective, print OK; if he cannot, print NG.

-----Sample Input-----
7
500 600

-----Sample Output-----
OK

Among the multiples of 7, for example, 567 lies between 500 and 600.

Source: atcoder | Difficulty: EASY


Solutions:
K = int(input())
(A, B) = map(int, input().split())
x = B // K * K
if x >= A:
	print('OK')
else:
	print('NG')


k = int(input())
(a, b) = map(int, input().split())
if (a - 1) // k < b // k:
	print('OK')
else:
	print('NG')


K = int(input())
(A, B) = map(int, input().split())
for i in range(A, B + 1):
	if i % K == 0:
		print('OK')
		return
print('NG')


k = int(input())
(a, b) = list(map(int, input().split()))
num = a // k
for i in range(num, num + 100):
	if k * i >= a and k * i <= b:
		print('OK')
		return
print('NG')


k = int(input())
(a, b) = list(map(int, input().split()))
t = b // k
u = (a - 1) // k
if t - u >= 1:
	print('OK')
else:
	print('NG')


K = int(input())
(A, B) = map(int, input().split())
print('ONKG'[B % K > B - A::2])


K = int(input())
(A, B) = map(int, input().split())
print('NG' if A % K != 0 and (A // K + 1) * K > B else 'OK')


def N():
	return int(input())

def L():
	return list(map(int, input().split()))

def NL(n):
	return [list(map(int, input().split())) for i in range(n)]
mod = pow(10, 9) + 7
k = N()
(a, b) = L()
for i in range(a, b + 1):
	if i % k == 0:
		print('OK')
		return
print('NG')


import sys
k = int(input())
(a, b) = map(int, input().split())
for x in range(a, b + 1):
	if x % k == 0:
		print('OK')
		return
print('NG')


K = int(input())
(A, B) = list(map(int, input().split()))
for x in range(A, B + 1):
	if x % K == 0:
		print('OK')
		break
else:
	print('NG')


k = int(input())
(a, b) = map(int, input().split())
c = (a + k - 1) // k
d = b // k
print('OK' if d - c >= 0 else 'NG')


k = int(input())
(a, b) = input().split()
a = int(a)
b = int(b)
x = b // k
if x * k >= a:
	print('OK')
else:
	print('NG')


k = int(input())
(a, b) = map(int, input().split())
for i in range(a, b + 1):
	if i % k == 0:
		print('OK')
		return
print('NG')


k = int(input())
(a, b) = map(int, input().split())
print('NG' if a // k == b // k and a % k != 0 else 'OK')


n = int(input())
(a, b) = map(int, input().split())
t = b // n
if t * n >= a:
	print('OK')
else:
	print('NG')


k = input()
(a, b) = input().split()
c = int(a)
d = int(b)
l = int(k)
e = d - d % l
if e >= c:
	print('OK')
else:
	print('NG')


a = int(input())
(b, c) = map(int, input().split())
for i in range(1000):
	if a * (i + 1) >= b:
		if a * (i + 1) <= c:
			print('OK')
			return
print('NG')


k = int(input())
(A, B) = map(int, input().split())
print('OK' if A <= B - B % k else 'NG')


k = int(input())
(a, b) = map(int, input().split())
flag = 0
for i in range(a, b + 1):
	if i % k == 0:
		flag = 1
		break
if flag == 1:
	print('OK')
else:
	print('NG')


K = int(input())
(A, B) = map(int, input().split())
s = 'NG'
for x in range(A, B + 1):
	if x % K == 0:
		s = 'OK'
print(s)


def __starting_point():
	k = int(input())
	(a, b) = list(map(int, input().split()))
	flg = False
	for i in range(a, b + 1):
		if i % k == 0:
			flg = True
			break
	if flg:
		print('OK')
	else:
		print('NG')
__starting_point()


K = int(input())
(A, B) = map(int, input().split())
ans = 0
i = 1
while K * i <= 1000:
	if A <= K * i and K * i <= B:
		ans = 1
		break
	i += 1
if ans == 1:
	print('OK')
else:
	print('NG')


x = int(input())
(a, b) = map(int, input().split())
max_b = b // x * x
if max_b >= a:
	print('OK')
else:
	print('NG')


a = int(input())
(b, c) = map(int, input().split())
d = c // a * a
if d >= b:
	print('OK')
else:
	print('NG')


k = int(input())
(a, b) = map(int, input().split())
print(['NG', 'OK'][b - b % k >= a])


(K, A, B) = map(int, open(0).read().split())
a = 'NG'
for N in range(A, B + 1):
	if N % K == 0:
		a = 'OK'
print(a)


K = int(input())
(A, B) = map(int, input().split())
print('NOGK'[-(-A // K) * K <= B::2])


(k, a, b) = map(int, open(0).read().split())
print('ONKG'[a > b // k * k::2])


K = int(input())
(A, B) = map(int, input().split())
li = []
for i in range(A, B + 1):
	li.append(i)
ans = False
for j in li:
	if j % K == 0:
		ans = True
		break
	else:
		ans = False
if ans == True:
	print('OK')
else:
	print('NG')


K = int(input())
(A, B) = map(int, input().split())
if B % K == 0 or A % K == 0 or B // K != A // K:
	print('OK')
else:
	print('NG')


def main():
	k = int(input())
	(a, b) = list(map(int, input().split()))
	ans = 'NG'
	for i in range(a, b + 1):
		if i % k == 0:
			ans = 'OK'
	return ans

def __starting_point():
	print(main())
__starting_point()


K = int(input())
(A, B) = list(map(int, input().split()))
M = B // K
print('OK' if K * M >= A else 'NG')


k = int(input())
(a, b) = list(map(int, input().split()))
if b // k != a // k or b % k == 0 or a % k == 0:
	print('OK')
else:
	print('NG')


K = int(input())
(A, B) = map(int, input().split())
print('NG' if all([i % K for i in range(A, B + 1)]) else 'OK')


K = int(input())
(A, B) = map(int, input().split())
ans = 0
for i in range(1000):
	if A <= K * i and K * i <= B:
		ans += 1
if ans == 0:
	print('NG')
else:
	print('OK')


n = int(input())
(a, b) = map(int, input().split())
if b // n - (a - 1) // n > 0:
	print('OK')
else:
	print('NG')


k = int(input())
(a, b) = map(int, input().split())
m = b // k
ans = 'OK' if k * m >= a else 'NG'
print(ans)


k = int(input())
(a, b) = input().split()
ans = 0
for i in range(int(a), int(b) + 1):
	if i % k == 0:
		ans = 1
if ans == 1:
	print('OK')
else:
	print('NG')


k = int(input())
(a, b) = map(int, input().split())
print('NOGK'[any([i % k == 0 for i in range(a, b + 1)])::2])


import math
k = int(input())
[a, b] = list(map(int, input().split()))
A = math.floor(a / k)
B = math.floor(b / k)
if A != B:
	print('OK')
elif k == 1:
	print('OK')
elif a % k == 0 or b % k == 0:
	print('OK')
else:
	print('NG')


K = int(input())
(A, B) = map(int, input().split())
TOP = B // K
BOTTOM = (A - 1) // K
d = TOP - BOTTOM
if d > 0:
	print('OK')
else:
	print('NG')


K = int(input())
(A, B) = [int(i) for i in input().split()]
print('OK' if (A + K - 1) // K <= B // K else 'NG')


K = int(input())
(A, B) = map(int, input().split())
n = A // K
print('OK' if A <= K * n <= B or K * (n + 1) <= B else 'NG')


K = int(input())
(A, B) = map(int, input().split())
judge = 'NG'
if B - A >= B % K:
	judge = 'OK'
print(judge)


K = int(input())
(A, B) = map(int, input().split())
n = 0
for i in range(A, B + 1):
	if i % K == 0:
		n = 1
		break
if n == 1:
	print('OK')
else:
	print('NG')


K = int(input())
(A, B) = (int(x) for x in input().split())
print('OK' if B - B % K >= A else 'NG')


K = int(input())
(A, B) = map(int, input().split())
print('NOGK'[K < B - A + 2 or B % K < A % K or B % K == 0 or (A % K == 0)::2])


k = int(input())
(a, b) = map(int, input().split())
q = 0
for i in range(1, 1000):
	if a <= k * i and k * i <= b:
		print('OK')
		q = 1
		break
if q == 0:
	print('NG')


k = int(input())
(a, b) = map(int, input().split())
val = b // k
if val * k in range(a, b + 1):
	print('OK')
else:
	print('NG')


K = int(input())
(A, B) = list(map(int, input().split()))
s = 0
for i in range(A, B + 1):
	if i % K == 0:
		print('OK')
		s = s + 1
		break
if s == 0:
	print('NG')


k = int(input())
(a, b) = map(int, input().split())
print('NOGK'[a // k < b // k or a % k < 1::2])


K = int(input())
(A, B) = list(map(int, input().split()))
i = 0
can = False
while i <= B:
	i += K
	if i >= A and i <= B:
		can = True
		break
if can:
	print('OK')
else:
	print('NG')


k = int(input())
(a, b) = list(map(int, input().split()))
for i in range(a, b + 1):
	ans = 'NG'
	if i % k == 0:
		ans = 'OK'
		break
print(ans)


K = int(input())
N = list(map(int, input().split()))
flag = 0
for i in range(N[0], N[1] + 1):
	if i % K == 0:
		flag = 1
		break
	else:
		continue
if flag == 1:
	print('OK')
else:
	print('NG')


K = int(input())
(a, b) = map(int, input().split())
print(['NG', 'OK'][b // K - (a - 1) // K > 0])


a = int(input())
(b, c) = map(int, input().split())
x = c // a
if x >= 1 and x * a >= b:
	print('OK')
else:
	print('NG')


K = int(input())
(A, B) = list(map(int, input().split()))
if B // K - A // K >= 1:
	print('OK')
elif B % K == 0:
	print('OK')
elif A % K == 0:
	print('OK')
else:
	print('NG')


K = int(input())
(A, B) = list(map(int, input().split()))

def ans165(K, A, B):
	ans_count = 0
	for i in range(A, B + 1):
		if i % K == 0:
			ans_count += 1
	if ans_count > 0:
		return 'OK'
	else:
		return 'NG'
print(ans165(K, A, B))


(k, a, b) = map(int, open(0).read().split())
print('NOGK'[b % k <= b - a::2])


k = int(input())
(a, b) = (int(i) for i in input().split())
if b // k > (a - 1) // k:
	print('OK')
else:
	print('NG')


k = int(input())
(a, b) = list(map(int, input().split()))
list1 = []
x = (k + a - 1) // k
y = b // k
for i in range(x, y + 1):
	list1.append(i)
if list1 == []:
	print('NG')
else:
	print('OK')


K = int(input())
(A, B) = map(int, input().split())
C = A // K
D = B // K
E = A % K
F = B % K
if E == 0 or F == 0:
	print('OK')
elif C == D:
	print('NG')
else:
	print('OK')


K = int(input())
(A, B) = map(int, input().split())
flag = False
for i in range(A, B + 1):
	if i % K == 0:
		flag = True
if flag:
	print('OK')
else:
	print('NG')


x = int(input())
(a, b) = map(int, input().split())
print(b // x * x >= a and 'OK' or 'NG')


Z = int(input())
(A, B) = map(int, input().split())
if B - A >= B % Z:
	print('OK')
else:
	print('NG')


import math
k = int(input())
(a, b) = map(int, input().split())
print('OK' if math.ceil(a / k) <= b / k else 'NG')


k = int(input())
(a, b) = list(map(int, input().split()))
n = k * int(a / k)
p = 'NG' if n < a and n + k > b else 'OK'
print(p)


k = int(input())
(a, b) = [int(x) for x in input().split()]
if b // k - (a - 1) // k > 0:
	print('OK')
else:
	print('NG')


k = int(input())
(a, b) = map(int, input().split())
ans = False
for x in range(a, b + 1):
	if x % k == 0:
		ans = True
if ans:
	print('OK')
else:
	print('NG')


K = int(input())
(a, b) = map(int, input().split())
if a <= b // K * K:
	print('OK')
else:
	print('NG')


def mult(x, d):
	return x // d
K = int(input())
(A, B) = map(int, input().split())
if mult(B, K) - mult(A - 1, K) > 0:
	print('OK')
else:
	print('NG')


K = int(input())
(A, B) = list(map(int, input().split()))
for i in range(1000):
	if A <= K * i <= B:
		print('OK')
		return
print('NG')


(k, a, b) = map(int, open(0).read().split())
print('OK' if b // k * k >= a else 'NG')


import sys

def input():
	return sys.stdin.readline().rstrip()
K = int(input())
(A, B) = map(int, input().split())
ans = False
count = K
while count <= B:
	if A <= count and count <= B:
		ans = True
	count += K
if ans:
	print('OK')
else:
	print('NG')


import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp
INF = inf
MOD = 1000000007
k = int(input())
(a, b) = [int(i) for i in input().split()]
tmp = 0
res = 'NG'
for i in range(a, b + 1):
	if i % k == 0:
		res = 'OK'
print(res)


n = int(input())
(a, b) = map(int, input().split())
n_a = a // n
n_b = (b + n - 1) // n
for i in range(n_a - 1, n_b + 1):
	if a <= n * i <= b:
		print('OK')
		return
print('NG')