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:
from math import *
from copy import *
from string import *				# alpha = ascii_lowercase
from random import *
from sys import stdin,stdout
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
import math
import math
import time
from queue import Queue
# PradeepGhosh_2017076

def seive(n):
	l=[True]
	l=l*(n+1)
	for i in range(2,int(sqrt(n))+1):
		if(l[i]==True):
			val=i*i
			while(val<len(l)):
				l[val]=False
				val+=i
	prime=[]
	for i in range(2,len(l)):
		if(l[i]==True):
			prime.append(i)
	return prime

def dp(l,i,n,val,ans):
	if(i>=n or val<0):
		return 1000000
	elif(val==0):
		return 0
	else:
		if(ans[i]==1000000):
			ans[i]=min(min(1+dp(l,i+1,n,val-l[i],ans),1+dp(l,i,n,val-l[i],ans)),dp(l,i+1,n,val,ans))
		return ans[i]
from queue import Queue
def factors(n):
	l=[]
	for i in range(1,int(sqrt(n))+1):
		if(n%i==0):
			if(n//i==i):
				l.append(i)
			else:
				l.append(i)
				l.append(n//i)
	return l
def check1(s,v,x):
	while(True):
		if(v not in s):
			return v
		else:
			v-=1
def check2(s,v,x):
	while(True):
		if(v not in s):
			return v
		else:
			v+=1

if __name__ == '__main__':
	# l=seive(1000000)
	# s=set(l)
	# t=int(input())
	# for i in range(t):
	# 	n=int(input())
	# 	if(n==2):
	# 		print(1)
	# 	else:
	# 		if(n in s):
	# 			n=n-1
	# 		j=n-1
	# 		while(j>0):
	# 			if(n%j==0):
	# 				break
	# 			j-=1
	# 		print(j)
	x=int(input())
	c=0
	ans=0
	while(ans!=360):
		ans+=x
		if(ans>360):
			ans-=360
		c+=1
	print(c)

Submission status: Accepted

Solution code:
def main():
    import sys
    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline
    readlines = sys.stdin.buffer.readlines
    sys.setrecursionlimit(10 ** 7)

    from math import gcd

    x = int(readline())
    print(360 // gcd(x, 360))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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:
import math
print(360 // math.gcd(360, int(input())))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

r = 0
ans = 0
while True:
  r += X
  r %= 360
  ans += 1
  if r == 0:
    break
print(ans)

Submission status: Accepted

Solution code:
from math import gcd

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from math import gcd

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    X = int(rl())
    
    ans = X * 360 // gcd(X, 360) // X
    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n=int(input())
mi=1/100000000
x=1
y=0
pi=math.pi
cnt=1
while abs(x)>mi or abs(y)>mi:
  x+=math.cos(cnt*n*pi/180)
  y+=math.sin(cnt*n*pi/180)
  cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
X = int(input())

d = 0
c = 0
while 1:
    c += 1
    d += X
    d %= 360
    if d==0:
        break
print(c)

Submission status: Accepted

Solution code:
def gcda(a,b):
    if a < b:
        a, b = b, a
    r = a % b
    if r == 0:
        return b
    return gcda(r, b)

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

X=int(input())
shukai=lcm(360,X)
print(shukai//X)

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
X = I()
g = gcd(360,X)
lcm = 360 * X // g
#print(lcm)
print(lcm // X)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

X = int(input())

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

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:
X = int(input())

def gcd(a, b):
  if a == 0:
    return b
  else:
    return gcd(b%a, a)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
x, k = X, 1
while x % 360:
  x += X
  k += 1
print(k)

Submission status: Accepted

Solution code:
import math
def make_divisors(n):
    divisors = []
    for i in range(1, int(math.sqrt(n))+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort(reverse=True)
    return divisors
def main():
    X = int(input())
    l = make_divisors(X)
    for i in l:
        if 360 % i == 0:
            return (360//i)
print(main())

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
a=x
k=0
while x!=0:
  x+=a
  x%=360
  k+=1
print(k+1)

Submission status: Accepted

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

Submission status: Accepted

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

X=int(readline())

K = 0
rad = 0
while True:
  rad += X
  K += 1
  if rad % 360 == 0:
    print(K)
    break

Submission status: Accepted

Solution code:
from math import gcd
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
y = 0
n =0
while(1):
  n += 1
  y += x
  y %= 360
  if(y==0):
    print(n)
    exit()

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
now = 0
res = 0
while True:
    res += 1
    now += n
    now %= 360
    if now == 0:
        print(res)
        break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

i = ni()

for j in range(1,360):
    if (360*j)%(360-i) == 0:
        n = (360*j)//(360-i)
        print(n)
        break

Submission status: Accepted

Solution code:
X = int(input())
from fractions import gcd
def lcm(x, y):
    return x * y // gcd(x, y)
l = lcm(X, 360)
print(l // X)

Submission status: Accepted

Solution code:
n=[360, 180, 120, 90, 72, 60, 360, 45, 40, 36, 360, 30, 360, 180, 24, 45, 360, 20, 360, 18, 120, 180, 360, 15, 72, 180, 40, 90, 360, 12, 360, 45, 120, 180, 72, 10, 360, 180, 120, 9, 360, 60, 360, 90, 8, 180, 360, 15, 360, 36, 120, 90, 360, 20, 72, 45, 120, 180, 360, 6, 360, 180, 40, 45, 72, 60, 360, 90, 120, 36, 360, 5, 360, 180, 24, 90, 360, 60, 360, 9, 40, 180, 360, 30, 72, 180, 120, 45, 360, 4, 360, 90, 120, 180, 72, 15, 360, 180, 40, 18, 360, 60, 360, 45, 24, 180, 360, 10, 360, 36, 120, 45, 360, 60, 72, 90, 40, 180, 360, 3, 360, 180, 120, 90, 72, 20, 360, 45, 120, 36, 360, 30, 360, 180, 8, 45, 360, 60, 360, 18, 120, 180, 360, 5, 72, 180, 120, 90, 360, 12, 360, 45, 
40, 180, 72, 30, 360, 180, 120, 9, 360, 20, 360, 90, 24, 180, 360, 15, 360, 36, 40, 90, 360, 60, 72, 45, 120, 180, 360]
a=int(input())
print(n[a-1])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math
 
def Strider():
 
    NumA = int(input())
 
    count = 360/NumA
    
    NumB = 1
    
    while ((360*NumB % NumA) != 0):
        NumB = NumB + 1
        count = 360*NumB/NumA
    
    print(int(count))
 
if __name__ == '__main__':
    Strider()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

a=int(input())
n=lcm(360,a)
print(n//a)

Submission status: Accepted

Solution code:
import math
x=int(input())
x=180-x

ans=360//math.gcd(360,x)

ex=[60,120]

if(x in ex):
    x=180-x
    ans=360//math.gcd(360,x)
print(ans)
#for i in range(1,180):
#    if(360//math.gcd(360,i)==6):
#        print(i,360//math.gcd(360,i))
#    if(i==x):
        #print("問題の箇所",x,ans)

Submission status: Accepted

Solution code:
import math
from fractions import Fraction

x = int(input())


k = 0
while True:
    k += 1
    s = x * k
    if s % 360 == 0:
        break
print(k)

Submission status: Accepted

Solution code:
n=int(input())
for i in range(1, n+1):
  x=360*i%n
  if x==0:
    print(360*i//n)
    break;
  else:
    continue;

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import gcd

X = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

import math

d=ni()

x=0
y=1
cnt=0
dd=0
while True:
  cnt+=1
  dd=(dd+d)%360
  r = math.radians(dd)
  x += math.sin(r)
  y += math.cos(r)

  # print("{}, {}".format(x,y))

  if abs(x)<10**(-10) and abs(y)<10**(-10):
    break
print(cnt+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
import math

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

    res=0
    vec=np.array([1,0])
    rot=np.array([[math.cos(math.radians(X)),-1*math.sin(math.radians(X))],[math.sin(math.radians(X)),math.cos(math.radians(X))]])
    pos=np.array([0,0])

    pos=pos+vec
    vec=np.dot(rot,vec)
    res+=1
    while abs(pos[0])>=0.001 or abs(pos[1])>=0.001:
        pos=pos+vec
        vec=np.dot(rot,vec)
        res+=1
    print(res)

if __name__=="__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x= int(input())
btdt=[]
theta=x+90
count=0
while(theta not in btdt):
    btdt.append(theta)
    theta=(theta+x)%360
    count+=1
print(count)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import math

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())
K=0
B=0
C=0
for i in range(0,360):
    B=B+X
    C=B%360
    K=K+1
    if C==0:
        print(K)
        break

Submission status: Accepted

Solution code:
import math
x = int(input())

def lcm(a):
    return (x*360)//math.gcd(x,360)

if 360%x==0:
    print(int(360/x))

else:
    print(int(lcm(x)/x))

Submission status: Accepted

Solution code:
x=int(input())
temp=360
while temp%x:
	temp+=360
print(temp//x)

Submission status: Accepted

Solution code:
x = int(input())

if 360 % x == 0:
    print(360//x)
else:
    mod = 360 % x
    n = 360 // x
    print(n * (360 // mod))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())

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

Submission status: Accepted

Solution code:
def resolve():
    import math
    x = int(input())

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

    if 360 % x == 0:
        print(360 // x)
    else:
        print(lcm(360, x) // x)


if 'unittest' not in globals():
    resolve()

Submission status: Accepted

Solution code:
import numpy as np
def cumsum(x):
    return list(np.cumsum(x))

def cumsum_number(N,K,x):
    ans=[0]*(N-K+1)
    number_cumsum = cumsum(x)
    number_cumsum.insert(0,0)
    for i in range(N-K+1):
        ans[i]=number_cumsum[i+K]-number_cumsum[i]
    return ans
"""
int #整数
float #小数

#for
for name in fruits: #fruitの頭から操作
    print(name)

#リスト
list0 = [] #リスト生成
list0 = [1,2,3,4] #初期化
list0 = [0]*10 #[0,0,0,0,0,0,0,0,0,0]
list1= [i for i in range(10)] #>>> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
list1 = list(map(int, input().split()))　# 複数の入力をリストに入れる
number=[int(input()) for i in range(int(input()))] #複数行の入力をリストに
list1 = list1 + [6, 7, 8] #リストの追加
list2.append(34) #リストの追加　最後に（）内が足される
list.insert(3,10) #リストの追加　任意の位置（追加したい位置,追加したい値）
len(list4) #リストの要素数
max(sa) #list saの最小値
list5.count(2) #リスト(文字列も可）内の2の数
list1.sort() #並び替え小さい順
list1.sort(reverse=True)  #並び替え大きい順
set(list1) #list1内の重複している要素を削除し、小さい順に並べる
sum([2,3,   ,3]) #リストの合計

abs(a) #aの絶対値
max(a,b) min(a,b) #最大値　最小値
text1 = text1.replace("34","test") #text1内の"34"を"test"に書き換える(文字列内の文字を入れ替える)

exit(0) #強制終了

cumsum(リスト) #累積和をリストで返す
cumsum_number(N,K,x) #N個の数が含まれるリストx内のK個からなる部分和をリストで返す
"""
X=int(input())
for i in range(1,1001):
    for j in range(1,1001):
        if (360*i)%(X*j)==0:
            ans=360*i//X
            print(ans)
            exit(0)

Submission status: Accepted

Solution code:

import math
cos=math.cos
sin=math.sin

def solve(x):
    p=math.pi
    z=x/360*p*2
    
    X,Y=0,0
    for i in range(10**5):
        X+=cos(z*i)
        Y+=sin(z*i)
        if X**2+Y**2<10**-6:
            #print(x,i+1,x*(i+1))
            return i+1
            break

x=int(input())
print(solve(x))

Submission status: Accepted

Solution code:
import math
x = int(input())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

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

Submission status: Accepted

Solution code:
x = int(input())
d = 360
while True:
    if d%x == 0:
        print(d//x)
        exit()
    d += 360

Submission status: Accepted

Solution code:
X=int(input())
for i in range(1,10**10):
    K=360*i//X
    if K*X==360*i:
        print(K)
        exit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
count = 1

while (X * count) % 360 != 0:
    count += 1

print(count)

Submission status: Accepted

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

print(int(lcm/x))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

def main():
    X = int(input())
    i = 1
    while True:
        if (X * i) % 360 == 0:
            break
        i += 1
    print(i)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import numpy as np

input_rad = int(input())
X, Y = 0, 0
Y = 1
t = 1
rad = input_rad

while True:
    radian = rad * np.pi / 180
    x = np.sin(radian)
    y = np.cos(radian)
    X += x
    Y += y
    t += 1
    rad += input_rad
    if abs(X) < 1.0 * np.exp(-5):
        X = 0
    if abs(Y) < 1.0 * np.exp(-5):
        Y = 0
    if X == 0:
        if Y == 0:
            print(t)
            break

Submission status: Accepted

Solution code:
x = int(raw_input())
p = 0
for i in xrange(361):
    p += x
    if p % 360 == 0:
        print i + 1
        break

Submission status: Accepted

Solution code:
n = int(input())
import numpy as np
x=0
y=0
rad=0
k=1
while(1):
  y+=np.cos(rad*np.pi/180)
  x+=np.sin(rad*np.pi/180)
  if x<0.0001 and y<0.0001:
    print(k)
    break
  else:
    k+=1
    rad+=n

Submission status: Accepted

Solution code:
#!python3

LI = lambda: list(map(int, input().split()))

# input
X = int(input())


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


def main():
    g = gcd(X, 360)
    v = X // g
    ans = 360 * v // X
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(i)

Submission status: Accepted

Solution code:
import math
def lcm(x, y):
    '''
    最小公倍数の計算
    '''
    return (x * y) // math.gcd(x, y)

X = int(input())
l = lcm(X, 360)
print(l // X)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())

x = a
i = 1

while x % 360 != 0:
    x += a
    i += 1

print(i)

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())
print(360//math.gcd(x,360))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math 
X = int(input())
lcm = round(360 * X / math.gcd(360, X))
K = round(lcm / X)
print(K)

Submission status: Accepted

Solution code:
x = int(input())

k = 0
sum = 0

while True:
    sum += x
    k += 1
    if sum % 360 == 0:
        break

print(k)

Submission status: Accepted

Solution code:
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

X = int(input())


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


l = lcm(360, X)

print(l // X)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
b=int(input())
print(lcm(360, b)//b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
g=gcd(n,360)
print(int(360/g))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

x = int(input())
a = math.gcd(360,x)
b = int(x/a)
c= int(360/a)
d = c*b
print(c)

Submission status: Accepted

Solution code:
x = int(input())

for i in range(3,361):
    xk = x*i
    if xk%360 == 0:
        print(i)
        exit()

Submission status: Accepted

Solution code:
x = int(input())
k = 360 / x
if k.is_integer():
  print(int(k))
else:
  for idx in range(2, x+1):
    tmp = k * idx
    if tmp.is_integer():
      print(int(tmp))
      break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

angle = int(input())
c = 1
x = 0
y = 1

while [round(x,2),round(y,2)] != [0,0]:
  angle_u= 180-angle*c
  y -= math.cos(math.radians(angle_u))
  x -= math.sin(math.radians(angle_u))
  c += 1
else:
  print(c)

Submission status: Accepted

Solution code:
x = int(input())


def my_gcd(a, b):
    cum = a * b
    if a > b:
        a, b = b, a
    while a != 0:
        a, b = b % a, a
    # b がgcd になっている
    return b


print(360 // my_gcd(x, 360))

Submission status: Accepted

Solution code:

x = int(input())
c = x

if 360%x ==0:
    print(int(360/x))
else:
    ct = 0
    while 360%x != 0 and x %360!=0:
        ct += 1
        x += c
    #print(x/c)
    print(ct+1)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
"""AtCoder Grand Contest 046: A - Takahashikun, The Strider
https://atcoder.jp/contests/agc046/tasks/agc046_a
"""


def calc(x):
    mod = 360 % x
    ans = 360 // x
    if mod == 0:
        return ans
    angle = 360 - mod
    while True:
        angle += x
        ans += 1
        if angle % 360 == 0:
            return ans


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x=int(input())
i=1

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
"""AtCoder Grand Contest 046: A - Takahashikun, The Strider
https://atcoder.jp/contests/agc046/tasks/agc046_a
"""


def calc(x):
    mod = 360 % x
    ans = 360 // x
    if mod == 0:
        return ans
    angle = 360 - mod
    while True:
    # for i in range(10):
        # print(angle)
        angle += x
        ans += 1
        if angle % 360 == 0:
            return ans
    # angle = x
    # mod = 360 % x
    # print('x:{}, mod:{}, mod_angle:{}'.format(x, mod, mod))
    # c = 360 - mod
    # ans = 360 // x
    # while True:
    #     print(ans)
    #     if c // 360 == 0:
    #         return ans
    #     ans += 1
    #     c += mod


def main():
    X = int(input())
    # for x in range(1, 180):
    #     print('{} => {}'.format(x, calc(x)))
    # print(calc(7))
    # ans = 0
    # while True:
    #     next = 360 % X
    #     if next == 0:
    #         ans = 360 // X
    #         break
    #     X = next
    print(calc(X))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

x = int(input())

y = 180-x

a = 360//math.gcd(360,x)

print(a)

Submission status: Accepted

Solution code:
from math import gcd

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

Submission status: Accepted

Solution code:
import math

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

if 360 % g != 0:
  print(360)
else:
  print(int(360/g))

Submission status: Accepted

Solution code:
import math
X = int(input())
Y = X
x = 1
y = 0
K = 1
while x != 0 or y != 0:
    x = round(x + math.cos(math.radians(X)),6)
    y = round(y + math.sin(math.radians(X)),6)
    X = X + Y 
    K += 1
print(K)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

count = 1
total_digree = X
while True:
    if total_digree % 360 == 0:
        break
    count += 1
    total_digree += X

print(count)

Submission status: Accepted

Solution code:
x=int(input())
t=x
if(360%x==0):
    print(360//x)
else:
    count=0
    while(x%360!=0):
        x+=t
        count+=1
    print(count+1)

Submission status: Accepted

Solution code:
def main():
    import math
    x = int(input())
    a, b = 0, 0
    t = 0
    c = 0
    while True:
        c += 1
        t += x
        t %= 360
        a += math.cos(math.radians(t))
        b += math.sin(math.radians(t))
        if abs(a) < 10 ** -13 and abs(b) < 10 ** -13:
            print(c)
            break

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())
b = 1
while (360*b%x) != 0:
    b += 1

print(360*b//x)

Submission status: Accepted

Solution code:

x = int(input())
k = 0

def gcd(a,b):
    if b == 0:
        return a

    return gcd(b, a%b)

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

saishoukoubai = lcm(360, x)
k = saishoukoubai / x

k = int(k)
print(k)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import Fraction
X = int(input())
# if 360%X==0:
#     print(int(360/X))
# elif 360%X==0:
#     print(int(360/X))
# else:
#     print(int(360*X))
    
print(Fraction(360, X).numerator)

Submission status: Accepted

Solution code:
x = int(input())
all = 360
while all % x != 0:
    all += 360
print(all//x)

Submission status: Accepted

Solution code:
import math
from fractions import Fraction
X = int(input())
n = 360 / X
m = Fraction(360,X)
s = m.denominator
a,b = math.modf(n)
if a == 0.0:
    print(int(n))
elif a != 0.0:
    ans = m * s
    print(int(ans))

Submission status: Accepted

Solution code:
x = int(input())

r = 0
cnt = 0
while True:
    r += x
    cnt += 1
    if r == 360:
        break
    if r > 360:
        r -= 360

print(cnt)

Submission status: Accepted

Solution code:
import math
import time

X = int(input())
K = 0
a = X
E = 0.1 ** 5

now = [0.0, 0.0]
while True:
    if now[0] <= E and now[0] >= -E and now[1] >= -E and now[1] <= E and K:
        print(K)
        break

    now[0] += math.cos(math.radians(a))
    now[1] += math.sin(math.radians(a)) 

    a += X
    K += 1

Submission status: Accepted

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

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

n = int(input())

if 360%n == 0:
    print(360//n)
else:
    print(lcm(n,360)//n)

Submission status: Accepted

Solution code:
import math
M = 360
X = list(map(int, input().split()))[0]
Y = math.gcd(M, X)

result = M // Y
print(result)

Submission status: Accepted

Solution code:
x=int(input())

ans=1
while True:
    q=360//x
    r=360%x
    ans*=q
    if r==0:
        break
    x=r
print(ans)

Submission status: Accepted

Solution code:
from math import sin, cos, radians

eps = 10**-5

def sim(rot):
    x, y = 0, 0
    nx, ny = 0, 1
    cnt = 0
    while True:
        x += nx
        y += ny
        # print(x, y, nx, ny)
        # if cnt >= 10:
            # break
        cnt += 1
        if -eps <= x <= eps and -eps <= y <= eps:
            break
        nx, ny = nx * cos(radians(rot)) -  ny * sin(radians(rot)), ny * cos(radians(rot)) + nx * sin(radians(rot))
    return cnt

# print(sim(90))
# exit(0)

n = int(input())
print(sim(n))

# for i in range(1, 180):
#     print(i, sim(i))

Submission status: Accepted

Solution code:
import math
x = int(input())
tol = 1e-6
ans = 1
cur = [0,1]
unit = x/180*math.pi
while cur[0]**2 + cur[1]**2 > tol:
    cur[0] += math.sin(ans*unit)
    cur[1] += math.cos(ans*unit)
    ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
#from collections import deque,defaultdict
from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

x = inn()
for i in range(1,361):
    #if ((180-x)*i)%360==0:
    if ((x)*i)%360==0:
        print(i)
        exit()