Created
May 26, 2016 11:03
-
-
Save LeoHeo/3a312c7defbba5631cac4f704b3710d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n, m = map(int, input().split()) | |
a = list(range(1, n+1)) | |
ans = [] | |
for i in range(n): | |
# m-1 pop | |
for j in range(m-1): | |
a.append(a.pop(0)) | |
ans.append(a.pop(0)) | |
#print('<%s>'%) | |
ans = 0.0 | |
for i in range(1000000): | |
ans += 0.000001 | |
abs(ans-1.0) < 1e-6 | |
# 유클리드 호제법 | |
def gcd(a, b): | |
if b == 0: | |
return a | |
else: | |
return gcd(b, a%b) | |
# 5 // 2 => 2 | |
# root N | |
def prime(n): | |
if n < 2: | |
return False | |
for i in range(2, int(n ** 0.5) + 1): | |
if n % i == 0: | |
return False | |
return True | |
i = 2 | |
while i*i <= n: | |
if n % i == 0: | |
#return False | |
i += 1 | |
n = 16 | |
check = [False] * (n+1) | |
# check[i] == True: i는 지워짐 | |
# check[i] == False: i는 지워지지 않음 | |
primes = [] | |
# O(N) * O(loglogN) = O(NloglogN) | |
for i in range(2, n+1): | |
# 지워 졌으면 스킵 | |
if check[i]: | |
continue | |
# 지워지지 않으면서 가장 작은 수 | |
if i >= 3: | |
primes.append(i) | |
# i*i부터 i의 배수를 모두 지워버린다 | |
for j in range(i*i, n+1, i): | |
check[j] = True | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment