Problem:


Score : 200 points

Problem Statement

Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times:

Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.

Constraints

1 \leq X \leq 179

X is an integer.

Input

Input is given from Standard Input in the following format:

X

Output

Print the number of times Takahashi will do the action before he is at the starting position again.

Sample Input 1

90

Sample Output 1

4

Takahashi's path is a square.

Sample Input 2

1

Sample Output 2

360



Sample input:
90


Sample output:
4

Submission status: Accepted

Solution code:
import bisect
import sys
import math
from collections import deque
from heapq import heappush, heappop

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))


INF = 1 << 29

DIV = (10**9) + 7


def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            self.fac = fac
            self.finv = finv
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % DIV) % DIV

    return CONV()


def cumsum(As):
    s = 0
    for a in As:
        s += a
        yield s


sys.setrecursionlimit(200005)


def dijkstra(G,start=0):
    heap = []
    cost = [INF]*len(G)
    heappush(heap,(0,start))
    while len(heap)!=0:
        c,n = heappop(heap)
        if cost[n] !=INF:
            continue
        cost[n]=c
        for e in G[n]:
            ec,v = e
            if cost[v]!=INF:
                continue
            heappush(heap,(ec+c,v))
    return cost


def main():
    X = iRaw()

        
    print((360)//math.gcd(X,360))




main()

Submission status: Accepted

Solution code:
from math import gcd

def main():
    x = int(input())
    y = x*360/gcd(x, 360)
    print(int(y//x))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    i = 1
    now = n
    while True:
        if now % 360 == 0:
            print(i)
            break
        else:
            i += 1
            now += n


main()

Submission status: Accepted

Solution code:
x = int(input())
"""
xをd倍すると360の倍数になる
"""
cnt = 0
ans = 0
while True:
	cnt += x
	ans += 1
	if cnt % 360 == 0:
		break
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
for y in range(1, 361):
    if 360 * y % x == 0:
        print(360 * y // x)
        exit()

Submission status: Accepted

Solution code:
i = 1
x = int(input())
while True:
  if (360 * i) % x == 0:
    print(360 * i // x)
    break
  i += 1

Submission status: Accepted

Solution code:
import math

x=int(input())

print(360//math.gcd(360,x))

Submission status: Accepted

Solution code:
import math

x = int(input())

g = math.gcd(x, 360)

l = x * 360 / g

ans = l // x

print(int(ans))

Submission status: Accepted

Solution code:
# coding: utf-8


def solve(*args: str) -> str:
    x = int(args[0])
    k = 1
    y = x
    while y % 360 != 0:
        y = y+x
        k += 1
    return str(k)


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

Submission status: Accepted

Solution code:
import math

angle = int(input())

print(360 // math.gcd(angle, 360))

Submission status: Accepted

Solution code:
def f(a,b):
    if b:
        return f(b,a%b)
    return a
print(360//f(int(input()),360))

Submission status: Accepted

Solution code:
X = int(input())
for i in range(1, 361):
  if X*i % 360 == 0:
    print(i)
    exit()

Submission status: Accepted

Solution code:
def main():
    import sys
    X=int(sys.stdin.readline())
    i=1
    while True:
        if 360*i%X==0:
            print(360*i//X)
            break
        i+=1
main()

Submission status: Accepted

Solution code:
import numpy as np
import math
import collections
import bisect


X = int(input())

print(int(360 / math.gcd(360, X)))

Submission status: Accepted

Solution code:
x = int(input())
count = 0
degree = 360
while degree!=0:
  if degree < 0:
    degree += 360
  degree = degree -x
  count +=1

print(count)

Submission status: Accepted

Solution code:
X = int(input())
ans = 0
for i in range(1000000):
    ans += X
    if ans % 360 == 0:
        print(i+1)
        exit()

Submission status: Accepted

Solution code:
from math import gcd
n = int(input())
print(360//gcd(360,n))

Submission status: Accepted

Solution code:
def main():
    X = int(input())
    t = 0

    for i in range(10**5):
        t += X
        if t % 360 == 0:
            return i + 1

print(main())

Submission status: Accepted

Solution code:
x = int(input())
ans = 0
p = 360
while p>0:
  if p<x:
    p+=360
  ans += p//x
  p = p%x

print(ans)

Submission status: Accepted

Solution code:
from math import gcd

X = int(input())
print(360 // gcd(X, 360))

Submission status: Accepted

Solution code:
#---------------------------iye ha aam zindegi---------------------------------------------
import math
import heapq,bisect
import sys
from collections import deque,defaultdict
from fractions import Fraction
mod=10**9+7
mod1=998244353
# ------------------------------warmup----------------------------
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# -------------------game starts now----------------------------------------------------import math
class SegmentTree1:
    def __init__(self, data, default=9999999, func=lambda a, b:a|b):
        """initialize the segment tree with data"""
        self._default = default
        self._func = func
        self._len = len(data)
        self._size = _size = 1 << (self._len - 1).bit_length()

        self.data = [default] * (2 * _size)
        self.data[_size:_size + self._len] = data
        for i in reversed(range(_size)):
            self.data[i] = func(self.data[i + i], self.data[i + i + 1])

    def __delitem__(self, idx):
        self[idx] = self._default

    def __getitem__(self, idx):
        return self.data[idx + self._size]

    def __setitem__(self, idx, value):
        idx += self._size
        self.data[idx] = value
        idx >>= 1
        while idx:
            self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
            idx >>= 1

    def __len__(self):
        return self._len

    def query(self, start, stop):
        if start == stop:
            return self.__getitem__(start)
        stop += 1
        start += self._size
        stop += self._size

        res = self._default
        while start < stop:
            if start & 1:
                res = self._func(res, self.data[start])
                start += 1
            if stop & 1:
                stop -= 1
                res = self._func(res, self.data[stop])
            start >>= 1
            stop >>= 1
        return res

    def __repr__(self):
        return "SegmentTree({0})".format(self.data)

# -------------------game starts now----------------------------------------------------import math
class SegmentTree:
    def __init__(self, data, default=0, func=lambda a, b: a*a + b*b):
        """initialize the segment tree with data"""
        self._default = default
        self._func = func
        self._len = len(data)
        self._size = _size = 1 << (self._len - 1).bit_length()

        self.data = [default] * (2 * _size)
        self.data[_size:_size + self._len] = data
        for i in reversed(range(_size)):
            self.data[i] = func(self.data[i + i], self.data[i + i + 1])

    def __delitem__(self, idx):
        self[idx] = self._default

    def __getitem__(self, idx):
        return self.data[idx + self._size]

    def __setitem__(self, idx, value):
        idx += self._size
        self.data[idx] = value
        idx >>= 1
        while idx:
            self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
            idx >>= 1

    def __len__(self):
        return self._len

    def query(self, start, stop):
        if start == stop:
            return self.__getitem__(start)
        stop += 1
        start += self._size
        stop += self._size

        res = self._default
        while start < stop:
            if start & 1:
                res = self._func(res, self.data[start])
                start += 1
            if stop & 1:
                stop -= 1
                res = self._func(res, self.data[stop])
            start >>= 1
            stop >>= 1
        return res

    def __repr__(self):
        return "SegmentTree({0})".format(self.data)
#-------------------------------iye ha chutiya zindegi-------------------------------------
class Factorial:
    def __init__(self, MOD):
        self.MOD = MOD
        self.factorials = [1, 1]
        self.invModulos = [0, 1]
        self.invFactorial_ = [1, 1]

    def calc(self, n):
        if n <= -1:
            print("Invalid argument to calculate n!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.factorials):
            return self.factorials[n]
        nextArr = [0] * (n + 1 - len(self.factorials))
        initialI = len(self.factorials)
        prev = self.factorials[-1]
        m = self.MOD
        for i in range(initialI, n + 1):
            prev = nextArr[i - initialI] = prev * i % m
        self.factorials += nextArr
        return self.factorials[n]

    def inv(self, n):
        if n <= -1:
            print("Invalid argument to calculate n^(-1)")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        p = self.MOD
        pi = n % p
        if pi < len(self.invModulos):
            return self.invModulos[pi]
        nextArr = [0] * (n + 1 - len(self.invModulos))
        initialI = len(self.invModulos)
        for i in range(initialI, min(p, n + 1)):
            next = -self.invModulos[p % i] * (p // i) % p
            self.invModulos.append(next)
        return self.invModulos[pi]

    def invFactorial(self, n):
        if n <= -1:
            print("Invalid argument to calculate (n^(-1))!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.invFactorial_):
            return self.invFactorial_[n]
        self.inv(n)  # To make sure already calculated n^-1
        nextArr = [0] * (n + 1 - len(self.invFactorial_))
        initialI = len(self.invFactorial_)
        prev = self.invFactorial_[-1]
        p = self.MOD
        for i in range(initialI, n + 1):
            prev = nextArr[i - initialI] = (prev * self.invModulos[i % p]) % p
        self.invFactorial_ += nextArr
        return self.invFactorial_[n]


class Combination:
    def __init__(self, MOD):
        self.MOD = MOD
        self.factorial = Factorial(MOD)

    def ncr(self, n, k):
        if k < 0 or n < k:
            return 0
        k = min(k, n - k)
        f = self.factorial
        return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
#--------------------------------------iye ha combinations ka zindegi---------------------------------
def powm(a, n, m):
    if a == 1 or n == 0:
        return 1
    if n % 2 == 0:
        s = powm(a, n // 2, m)
        return s * s % m
    else:
        return a * powm(a, n - 1, m) % m
#--------------------------------------iye ha power ka zindegi---------------------------------
def sort_list(list1, list2):
    zipped_pairs = zip(list2, list1)

    z = [x for _, x in sorted(zipped_pairs)]

    return z
#--------------------------------------------------product----------------------------------------
def product(l):
    por=1
    for i in range(len(l)):
        por*=l[i]
    return por
#--------------------------------------------------binary----------------------------------------
def binarySearchCount(arr, n, key):
    left = 0
    right = n - 1

    count = 0

    while (left <= right):
        mid = int((right + left) / 2)

        # Check if middle element is
        # less than or equal to key
        if (arr[mid] <= key):

            # At least (mid + 1) elements are there
            # whose values are less than
            # or equal to key
            count = mid + 1
            left = mid + 1

        # If key is smaller, ignore right half
        else:
            right = mid - 1

    return count
#--------------------------------------------------binary----------------------------------------
def countdig(n):
    c=0
    while(n>0):
        n//=10
        c+=1
    return c
def countGreater(arr, n, k):
    l = 0
    r = n - 1

    # Stores the index of the left most element
    # from the array which is greater than k
    leftGreater = n

    # Finds number of elements greater than k
    while (l <= r):
        m = int(l + (r - l) / 2)

        # If mid element is greater than
        # k update leftGreater and r
        if (arr[m] > k):
            leftGreater = m
            r = m - 1

        # If mid element is less than
        # or equal to k update l
        else:
            l = m + 1

    # Return the count of elements
    # greater than k
    return (n - leftGreater)
#--------------------------------------------------binary------------------------------------
n=int(input())
t=360
while(t%n!=0):
    t+=360
print(t//n)

Submission status: Accepted

Solution code:
x = int(input())
d, k = x, 1
while True:
    if d%360==0:
        print(k)
        break
    d += x
    k += 1

Submission status: Accepted

Solution code:
X = int(input())
ans = 1
while(True):
    if (X*ans) %360 == 0:
        break
    else:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:

t=int(input())
for i in range(1,361):
    if (t*i)%360==0:
        print(i)
        break

Submission status: Accepted

Solution code:
x = int(input())
angle = 0
for i in range(10000):
    angle += x
    if angle % 360 == 0:
        print(i+1)
        break
    elif angle > 360:
        angle %= 360
    else:
        pass

Submission status: Accepted

Solution code:
x = int(input())
count = 0
r = 0
while True:
    count += 1
    r += x
    if r % 360 == 0:
        print(count)
        break

Submission status: Accepted

Solution code:
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

x=int(input())
cnt=1
while cnt*x%360!=0:
    cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
X=int(input())

ans=1
temp=X
while temp%360!=0:
    temp+=X
    ans+=1

print(ans)

Submission status: Accepted

Solution code:
x = int(input())

from math import gcd
def lcm(x,y):
    return x // gcd(x, y) * y

print(lcm(360,x)//x)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X = INT()

for i in range(1, 1000):
	if (X*i)%360 == 0:
		print(i)
		exit()

Submission status: Accepted

Solution code:
import math
X = int(input())
ans = 360 // math.gcd(360,X)
print(ans)

Submission status: Accepted

Solution code:
x=int(input())
for i in range(1,361):
    if i*x%360==0:
        break
print(i)

Submission status: Accepted

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


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

#import numpy as np


def main():
	n=II()

	for i in range(1,10**5):
		if (n*i)%360==0:
			print(i)
			exit()










if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
import math
N = int(input())
print(360//math.gcd(N, 360))

Submission status: Accepted

Solution code:
x = int(input())
for i in range(1,10000):
  if i*360%x == 0:
    print(i*360//x)
    break

Submission status: Accepted

Solution code:
import math
x = int(input())
d = math.gcd(360, x)
print(360//d)

Submission status: Accepted

Solution code:
from fractions import gcd
x = input()

lcm = x * 360 / gcd(x, 360)
print lcm / x

Submission status: Accepted

Solution code:
X = int(input())
i = 1
while True:
    if i*X%360 == 0:
        print(i)
        break
    else:
        i += 1

Submission status: Accepted

Solution code:
x = int(input())
for i in range(1,10000):
    if (i*x) % 360 == 0:
        print(i)
        break

Submission status: Accepted

Solution code:
def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

def lcm(a, b):
    return a//gcd(a, b)*b

x = int(input())
print(lcm(x,360)//x)

Submission status: Accepted

Solution code:
x=int(input())

cnt=1

kaku=x

for i in range(1000):
    if kaku%360!=0:
        kaku=kaku+x
        cnt=cnt+1
print(cnt)

Submission status: Accepted

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

X = int(input())

a = 1
while a*X % 360 != 0:
    a += 1

print(a)

Submission status: Accepted

Solution code:
x = int(input())
for i in range(1, 10**5):
    if x*i%360==0:
        print(i)
        exit(0)

Submission status: Accepted

Solution code:
x = int(input())

for i in range(1, 10000):
    if (x * i % 360 == 0):
        print(i)
        exit()

Submission status: Accepted

Solution code:
x = int(input())
u = 0
cnt = 0
while True:
    u += x
    cnt += 1
    if u % 360 == 0:
        print(cnt)
        exit()

Submission status: Accepted

Solution code:
from math import gcd

X = int(input())

ans = 360 // gcd(360, X)
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
L = 360
def gcd(x, y):
    k, l = x, y
    if y < 0:
        k, l = -k, -l
    while l:
        k, l = l, k % l
    return k
Y = gcd(X, L)
print(L // Y)

Submission status: Accepted

Solution code:
from math import *
x=int(input())
k = 0
for _ in range(9999):
    k += 1
    if x * k % 360 == 0:
        print(k)
        exit()

Submission status: Accepted

Solution code:
from math import gcd

X = int(input())


def lcm(x, y):
    return x // gcd(x, y) * y


n = lcm(X, 360)
print(n // X)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline

import math


def main():
    X = int(input())

    Y = (360 * X) // math.gcd(360, X)
    print(Y // X)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

import math
X = int(input())

print ((X*360//math.gcd(X,360)) // X)

Submission status: Accepted

Solution code:
from math import gcd
x = int(input())
g = gcd(x,360)
print(((360//g)*(x//g)*g)//x)

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

def solve():
    x = ni()
    print(360 // gcd(360, x))
    return

solve()

Submission status: Accepted

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

X=int(readline())

import math
g = math.gcd(X,360)
L = (X // g) * 360

print(L // X)

Submission status: Accepted

Solution code:
n = int(input())
ans = 1
t = n
while t % 360 != 0:
    t += n
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys
x=int(input())
x=min(x,360-x)

for i in range(1,361):
    if (i*x)%360==0:
        print(i)
        sys.exit()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

x = int(input())
for i in range(1, 1000):
    if i * x % 360 == 0:
        print(i)
        exit()

Submission status: Accepted

Solution code:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

x=int(input())
for i in range(1,1000):
    if (i*360)%x==0:
        print((i*360)//x)
        exit()

Submission status: Accepted

Solution code:
def gcd(m, n):
    if n > m:
        return gcd(n, m)
    elif n == 0:
        return m
    return gcd(n, m % n)

X = int(input())
print(360 * X // gcd(360, X) // X)

Submission status: Accepted

Solution code:
import sys

def lcm(a, b):
    a, b = max(a, b), min(a, b)
    c = a * b
    while a % b > 0:
        a, b = b, a % b
    return c // b

def solve():
    input = sys.stdin.readline
    X = int(input())
    L = lcm(360, X)
    print(L // X)

    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
import math
x=int(input())
num=360*x/math.gcd(360,x)
print(int(num//x))

Submission status: Accepted

Solution code:
X = int(input())

t = 1
while X * t % 360 != 0:
    t += 1

print(t)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
INF = float("inf")


def main():
    X = int(input())
    for k in range(1, 361):
        d, m = divmod(X*k, 360)
        # print(d, m)
        if m == 0:
            print(k)
            return

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X = int(input())

for i in range(1,361):
    if (i * X)%360 == 0:
        print(i)
        exit()

Submission status: Accepted

Solution code:
x = int(input())

for k in range(1, 100000):
  if (k * x) % 360 == 0:
    print(k)
    exit()

Submission status: Accepted

Solution code:
x = int(input())
ans = 0
cnt = 0
while True:
  ans += x
  cnt += 1
  if ans%360 == 0:
    print(cnt)
    break

Submission status: Accepted

Solution code:
import math


#n=map(int,input().split())

x=int(input())
i=1
tempx=0
while True:
    tempx+=x
    if tempx%360==0:
        print(i)
        break
    i+=1

Submission status: Accepted

Solution code:
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

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

#処理内容
def main():
	X = int(input())
	for i in range(1, 361):
		if (X * i) % 360 == 0:
			print(i)
			return

if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
X = int(input())
cnt = 1
while True:
    if (cnt*X)%360 == 0:
        print(cnt)
        break
    else:
        cnt += 1

Submission status: Accepted

Solution code:
x = int(input())

count=1
test= 0
test+=x
while test%360!=0:
	test+=x
	count+=1
print(count)

Submission status: Accepted

Solution code:
t=int(input())
i=1
while((i*t)%360!=0):
    i+=1
print(i)

Submission status: Accepted

Solution code:
def solve(x):
    s = 0
    for i in range(360):
        s += x
        if s % 360 == 0:
            return i + 1
    return 0


def main():
    x = int(input())
    res = solve(x)
    print(res)


def test():
    assert solve(90) == 4
    assert solve(1) == 360


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

Submission status: Accepted

Solution code:
X = int(input())
for i in range(1,100000):
  if (X*i)%360 == 0:
    print(i)
    exit()

Submission status: Accepted

Solution code:
import math
def lcm(a, b):
    return a*b//math.gcd(a, b)
n = int(input())
p = lcm(n, 360)
ans = p // n
print(ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

X = I()

from math import gcd

print(360//gcd(360,X))

Submission status: Accepted

Solution code:
x = int(input())

for i in range(1,180):
    a = 360 * i
    if a % x == 0:
        print(int(a/x))
        exit()

Submission status: Accepted

Solution code:
x = int(input())
for i in range(1, 361):
    if x * i % 360 == 0:
        print(i)
        break

Submission status: Accepted

Solution code:
from math import gcd
print(360 //gcd(360, int(input())))

Submission status: Accepted

Solution code:
from math import gcd
g = gcd(int(input()), 360)
print(360 // g)

Submission status: Accepted

Solution code:
X = int(input())
ans = 0
d = 0
while True:
    d += X
    ans += 1
    if d%360==0:
        print(ans)
        exit()

Submission status: Accepted

Solution code:
import sys
def input():return sys.stdin.readline()[:-1]
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())
def LN(n):return [N() for i in range(n)]
def LL(n):return [L() for i in range(n)]
from math import gcd 
x=N()
print(x*360//gcd(x,360)//x)

Submission status: Accepted

Solution code:
from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt
import math

import bisect
import re
import heapq


from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


yes = "Yes"
no = "No"


def main():
    x = ii()
    for i in range(1,400):
        if (x*i) % 360 == 0:
            print(i)
            exit()




main()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

x, = map(int,readline().split())


from math import gcd

g = gcd(x,360)
print(360//g)

Submission status: Accepted

Solution code:
X = int(input())
res = 10**18
for k in range(1,10000):
    if k*X%360==0:
        res = k
        break
print(res)

Submission status: Accepted

Solution code:
import sys
import math

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

X = int(input())
g = math.gcd(360, X)

print(360 // g)

Submission status: Accepted

Solution code:
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

n = int(input())
k = 1
while n*k %360 != 0:
    k += 1

print(k)

Submission status: Accepted

Solution code:
x = int(input())

for i in range(1,500):
	if x * i % 360 == 0:
		print(i)
		break

Submission status: Accepted

Solution code:
from collections import *
import sys
try: inp = raw_input
except: inp = input
def err(s):
    sys.stderr.write('{}\n'.format(s))

def ni():
    return int(inp())

def nl():
    return [int(_) for _ in inp().split()]

X = ni()

def gcd(a, b):
    return a if b == 0 else gcd(b, a%b)
g = gcd(X, 360)
print(360//g)

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = onem()
po = lcm(360,n)
print(po//n)

Submission status: Accepted

Solution code:
x = int(input())
now = 0
ans = 0
for i in range(400):
    now += x
    ans += 1
    if now % 360 == 0:
        break
print(ans)