Problem:


Score: 100 points

Problem Statement

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 1

7
500 600

Sample Output 1

OK

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

Sample Input 2

4
5 7

Sample Output 2

NG

No multiple of 4 lies between 5 and 7.

Sample Input 3

1
11 11

Sample Output 3

OK



Sample input:
7
500 600


Sample output:
OK

Submission status: Accepted

Solution code:
def main():
    k = int(input())
    a, b = input_list()

    for i in range(a, b+1):
        if i % k == 0:
            print('OK')
            exit()
    print('NG')


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

def main():
    N = int(input())
    A, B = map(int, input().split())

    ans = 'NG'
    for i in range(A, B+1):
        if i%N == 0:
            ans = 'OK'
            break
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
t = int(input())
x,y = map(int,input().strip().split())
f = 0
for i in range(x,y+1):
    if i%t==0:
        f = 1
        break
if f:
    print("OK")
else:
    print("NG")

Submission status: Accepted

Solution code:
import sys

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

for i in range(A, B + 1):
    if i % K == 0:
        print("OK")
        sys.exit()
print("NG")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
K = int(input())
A, B = map(int, input().split())

for i in range(1001):
    if A <= i * K <= B:
        print('OK')
        exit()
else:
    print('NG')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
import sys,os
from collections import defaultdict, deque
from math import ceil, floor
if sys.version_info[1] >= 5:
    from math import gcd
else:
    from fractions import gcd
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD = 10**9+7

    K = II()
    A,B = LMIIS()
    for i in range(A,B+1):
        if i % K == 0:
            print('OK')
            return
    print('NG')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
k = int(input())
a,b = [int(x) for x in input().split()]
for i in range(a,b+1):
    if i%k==0:
        print("OK")
        break
else:
    print("NG")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    k = int(input())
    a,b = map(int,input().split())
    answer = "NG"
    for i in range(a,b+1):
        if i % k == 0:
            answer = "OK"
            break
    print(answer)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
K = int(input())
A, B = map(int, input().split())
print('OK' if any([a % K == 0 for a in range(A, B+1)]) else 'NG')

Submission status: Accepted

Solution code:
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    K = int(input())
    A,B = map(int,input().split())

    res = 'NG'

    for i in range(A,B+1):
        if i % K == 0:
            res = 'OK'

    print(res)



main()

Submission status: Accepted

Solution code:
from sys import stdin
K = int(stdin.readline().rstrip())
A,B = [int(x) for x in stdin.readline().rstrip().split()]
f = False
for i in range(A,B+1):
    if i % K == 0:
        f = True
if f:
    print("OK")
else:
    print("NG")

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]
N = int(input())
A,B = map(int,input().split(' '))

for i in range(A,B+1):
    if i%N==0:
        print('OK')
        exit()
else:
    print('NG')

Submission status: Accepted

Solution code:
K = int(input())
A, B = map(int, input().split())
if B // K == (A - 1) // K:
  print("NG")
else:
  print("OK")

Submission status: Accepted

Solution code:
def solve(k, a, b):
    for i in range(a, b + 1):
        if i % k == 0:
            return "OK"
    return "NG"


def main():
    k = int(input())
    a, b = map(int, input().split())
    res = solve(k, a, b)
    print(res)


def test():
    assert solve(7, 500, 600) == "OK"
    assert solve(4, 5, 7) == "NG"
    assert solve(1, 11, 11) == "OK"


if __name__ == "__main__":
    test()
    main()

Submission status: Accepted

Solution code:
k = int(input())
o = k
a, b = list(map(int, input().split()))

while k <= b:
    if a <= k <= b:
        print('OK')
        break

    k += o

else:
    print('NG')

Submission status: Accepted

Solution code:
K=int(input())
A,B=map(int,input().split())

for i in range(A,B+1):
    if i%K==0:
        print("OK")
        exit()
print("NG")

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    K = int(readline())
    A,B = map(int, readline().split())

    for i in range(A, B+1):
        if i % K == 0:
            print("OK")
            exit()
    
    print("NG")

    


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

if __name__ == '__main__':
    k = int(sys.stdin.readline())
    a, b = list(map(lambda x: int(x), sys.stdin.readline().split(' ')))
    for i in range(a, b+1):
        if i % k == 0:
            print('OK')
            break
    else:
        print('NG')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
K = int(input())
A, B = map(int, input().split())

ans = "NG"
for i in range(A, B+1):
  if i % K == 0:
    ans = "OK"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import bisect
# import copy
# import heapq
# from collections import deque
# import decimal

# sys.setrecursionlimit(100001)
INF = sys.maxsize
MOD = 10 ** 9 + 7


# ===CODE===

k = int(input())
a,b = map(int,input().split())

for i in range(a,b+1):
    if i%k==0:
        print("OK")
        exit(0)

print("NG")

Submission status: Accepted

Solution code:
import sys
K = int(input())
A, B = map(int,input().split())

for i in range(A,B+1):
  if i%K == 0:
    print("OK")
    sys.exit()

print("NG")

Submission status: Accepted

Solution code:
k=int(input())
a,b=map(int,input().split())

i=1
while k*i<=b:
    if a<=k*i and k*i<=b:
        print("OK")
        exit()
    i+=1

print("NG")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a,b = map(int,input().split())
#L = list(map(int,input().split()))
for i in range(a,b+1):
    if i%n == 0:
        print("OK")
        exit()
print("NG")

Submission status: Accepted

Solution code:
K = int(input())
A, B = map(int, input().split())
for m in range(1, 1001):
  if A<=m*K and m*K<=B:
    print('OK')
    exit()
print('NG')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
K = int(input())
A,B = map(int,input().split())


for i in range(A,B + 1):
    if i % K == 0:
        print("OK")
        exit()
        

print("NG")

Submission status: Accepted

Solution code:
"""def power(x, y): 
    res = 1
    x=x
    while (y > 0): 
        if ((y & 1) == 1) : 
            res = (res * x) 
        y = y >> 1
        x = (x * x)
    return res""" 
"""def fact(n):
    if(n==0):
        return 1
    if(n==1):
        return 1
    return fact(n-1)+fact(n-2)"""
 
import math
#import combinations
 
 
#t=int(input())
#for _ in range(t):
n=int(input())
    #s=input()
    #arr=list(map(int,input().split()))
    #b=list(map(int,input().split()))
    #d={}
    #flag=0
    #ans=0
    #n,k=map(int,input().split())
a,b=map(int,input().split())
flag=0
for i in range(a,b+1):
    if(i%n==0):
        flag=1
if(flag==1):
    print("OK")
else:
    print("NG")

Submission status: Accepted

Solution code:
k = int(input())
a,b = map(int,input().split())

u = 0
for i in range(a,b+1):
    if i%k==0:
        u +=1

if u == 0:
    print('NG')
else:
    print('OK')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
K = int(input())
A,B = map(int, input().split())

for i in range(B+1):
    if A <= K*i <= B:
        print("OK")
        quit()

print("NG")

Submission status: Accepted

Solution code:
k = int(input())
a,b = map(int, input().split())
i = (a-1)//k
j = b//k
if j-i >= 1:
    print('OK')
else:
    print('NG')

Submission status: Accepted

Solution code:
N = int(input())
A,B = map(int,input().split())

for i in range(A,B+1):
  if i % N == 0:
    print("OK")
    exit()
print("NG")

Submission status: Accepted

Solution code:
k = int(input())
a, b = map(int, input().split())

for i in range(a, b + 1):
    if i%k == 0:
        print("OK")
        exit()

print("NG")

Submission status: Accepted

Solution code:
k = int(input())
a, b = map(int, input().split())

ans = "NG"
for i in range(a, b + 1):
    if i % k == 0:
        ans = "OK"
        break
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8


def solve(*args: str) -> str:
    k = int(args[0])
    a, b = map(int, args[1].split())

    return 'OK' if -(-a//k)*k <= b else 'NG'


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Accepted

Solution code:
k=int(input())
a,b=(int(i) for i in input().split())
c=0
for i in range(a,b+1):
  if(i%k==0):
    print("OK")
    c=1
    break
if(c==0):
  print("NG")

Submission status: Accepted

Solution code:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from math import factorial, sqrt, ceil, gcd
from functools import lru_cache, reduce
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# 素数判定
def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True


# limit以下の素数を列挙
def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P

# 同じものを含む順列
def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        # set（集合）型で重複を削除、ソート
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret


# ここから書き始める
k = int(input())
a, b = map(int, input().split())
yes = False
for i in range(a, b + 1):
    if i % k == 0:
        yes = True
        break
if yes:
    print("OK") 
else:
    print("NG")

Submission status: Accepted

Solution code:
n = int(input())
a,b = map(int,input().split())
for i in range(a,b+1):
  if i % n == 0:
    print("OK")
    exit()
print("NG")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    k = int(input())
    a, b = [int(x) for x in input().split()]

    for i in range(a, b + 1):
        if i % k == 0:
            return 'OK'
    return 'NG'


if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
k = int(input())

n, m = [int(x) for x in input().split()]

for i in range(n, m+1):
  if i%k == 0:
    print('OK')
    quit()

print("NG")

Submission status: Accepted

Solution code:
k = int(input())
a, b = [int(i) for i in input().split()]

for i in range(a, b+1):
  if i % k == 0:
    print('OK')
    break
else:
  print('NG')

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    k=int(input())
    a,b=map(int,input().split())
    for i in range(a,b+1):
        if i%k==0:
            print("OK")
            break
    else:
        print("NG")

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
K = int(input())
A, B = map(int, input().split())

for i in range(A, B+1):
    if i % K == 0:
        print("OK")
        import sys
        sys.exit()
print("NG")

Submission status: Accepted

Solution code:
k = int(input())
a,b = map(int,input().split())

c = 0
for i in range(a,b+1) :
    if i%k == 0 :
        c = 1

if c == 1 :
    print('OK')
else :
    print('NG')

Submission status: Accepted

Solution code:
k=int(input())
a,b=list(map(int,input().split()))
for i in range(a,b+1):
  if i%k==0:
    print("OK");break
else:
  print("NG")

Submission status: Accepted

Solution code:
def main():
    k = int(input())
    a, b = map(int, input().split())
    for i in range(a, b + 1):
        if i % k == 0:
            print("OK")
            break
    else:
        print("NG")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
n = int(input())

a, b = map(int, input().split())

for i in range(a, b+1):
  if i % n == 0:
    print("OK")
    sys.exit()
print("NG")

Submission status: Accepted

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

ans = 0
for i in range(A,B+1):
    if i % K == 0:
        ans = 1
        break

if ans == 0:
    print("NG")
else:
    print("OK")

Submission status: Accepted

Solution code:
K = int(input())
B,C = map(int,input().split())
#N = str(input())

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.readline

K = int(readline())
A, B = map(int, readline().split())

for i in range(A, B + 1):
    if i % K == 0:
        print('OK')
        exit(0)

print('NG')

Submission status: Accepted

Solution code:
K=int(input())
A,B=map(int,input().split())
t=0
while t<=B:
    if t>=A:
        print('OK')
        exit()
    t+=K
print('NG')

Submission status: Accepted

Solution code:
a = int(input())
c,d = map(int, input().split())

for i in range(c,d+1):
  if i % a ==0:
    print('OK')
    exit()
print('NG')

Submission status: Accepted

Solution code:
import sys
k = int(input())
a,b = map(int,input().split())
for i in range(a,b+1):
    if i % k == 0:
        print("OK")
        sys.exit()
print("NG")