s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time int64 0 100 | memory stringlengths 4 6 | code_size int64 15 14.7k | code stringlengths 15 14.7k | problem_id stringlengths 6 6 | problem_description stringlengths 358 9.83k | input stringlengths 2 4.87k | output stringclasses 807
values | __index_level_0__ int64 1.1k 1.22M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s312454322 | p04048 | u774144884 | 1552858323 | Python | Python (3.4.3) | py | Accepted | 17 | 3060 | 373 | # -*- coding: utf-8 -*-
def rli():
return list(map(int, input().split()))
def solve(n, x):
if x < n - x:
x = n - x
w = n - x
t = (w - (x % w)) % w
res = (x + w - 1) // w * 3 * w - t * 3
if t != 0:
res += solve(w, w - t)
return res
def main():
n, x = rli()
print(... | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,617 |
s269810115 | p04048 | u835629653 | 1552785728 | Python | Python (3.4.3) | py | Accepted | 17 | 3060 | 140 | n, x = map(int, input().split())
total = n
a = x
b = n - x
while a > 0:
total += (a * 2) * (b // a)
a, b = b % a, a
print(total - b) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,618 |
s583034545 | p04048 | u350049649 | 1552766374 | Python | Python (3.4.3) | py | Accepted | 22 | 3316 | 207 | N,x=map(int,input().split())
x=min(x,N-x)
rem=[N-x,x]
len=x
ans=N
i=1
while True:
i=(i+1)%2
ans+=2*(rem[i]//len)*len
rem[i]=rem[i]%len
if rem[i]!=0:
len=rem[i]
else:
break
print(ans-len) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,619 |
s558246325 | p04048 | u843135954 | 1552745808 | Python | Python (3.4.3) | py | Accepted | 17 | 3064 | 398 | import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
n,x = na()
def loop(a,b):
h = max(a,b)
w = min(a,b)
if h%w == 0:
return int((2*h/w-1)*w)
else:
m... | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,620 |
s140575390 | p04048 | u766684188 | 1552277793 | Python | Python (3.4.3) | py | Accepted | 18 | 3060 | 173 | def f(a,b):
a,b=min(a,b),max(a,b)
if b%a==0:
return (2*b//a-1)*a
else:
return 2*a*(b//a)+f(a,b%a)
n,x=map(int,input().split())
print(n+f(x,n-x)) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,621 |
s380813222 | p04048 | u643840641 | 1552062187 | Python | Python (3.4.3) | py | Accepted | 18 | 3060 | 196 | n, x = map(int, input().split())
p = n
if x * 2 > n:
x = n - x
ans = 0
while(x > 0):
if n == p:
ans += 3 * x * (n // x - 1)
else:
ans += 3 * x * (n // x)
n, x = x, n % x
print(ans) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,622 |
s101809950 | p04048 | u352623442 | 1551775023 | Python | Python (3.4.3) | py | Accepted | 18 | 2940 | 194 | n,x = map(int,input().split())
def gcd(a,b):
if a%b == 0:
return b
else:
return gcd(b,a%b)
k = gcd(n,x)
if k == 1:
print((n-1)*3)
else:
print((int(n/k)-1)*3*k)
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,623 |
s037011222 | p04048 | u525796732 | 1551769231 | Python | Python (3.4.3) | py | Accepted | 20 | 3064 | 466 | def main():
n,x=map(int,input().split())
a,b=n-x,x
if(a<b):
a,b=b,a
path_length = calc_path(a,b,n)
print(path_length)
def calc_path(a1,b1,c1):
q , mod=divmod(a1,b1)
count=0
if mod==0:
c2=c1+2*b1*q-b1
return c2
else:
count=count+1
c2=c1+2*b1*... | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,624 |
s552887138 | p04048 | u809898133 | 1551564661 | Python | Python (3.4.3) | py | Accepted | 17 | 3060 | 161 | def gcd(x,y):
if(x < y): x,y = y,x
if(y == 0): return x
return gcd(y,x % y)
n,x = map(int,input().split())
g = gcd(n,x)
n //= g
print((3*n-3)*g) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,625 |
s994394061 | p04048 | u745087332 | 1551315696 | Python | Python (3.4.3) | py | Accepted | 20 | 3188 | 592 | # coding:utf-8
import sys
INF = float('inf')
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II():... | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,626 |
s525625050 | p04048 | u075012704 | 1551199576 | Python | Python (3.4.3) | py | Accepted | 17 | 2940 | 276 | import sys
sys.setrecursionlimit(10 ** 9)
N, X = map(int, input().split())
def rec(a, b):
a, b = min(a, b), max(a, b)
if b % a == 0:
return (2 * a) * (b // a) - a
else:
return (2 * a) * (b // a) + rec(a, b % a)
print(X + N - X + rec(X, N - X))
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,627 |
s588314224 | p04048 | u794173881 | 1551158684 | Python | Python (3.4.3) | py | Accepted | 18 | 3060 | 216 | n,x = map(int,input().split())
x = min(x,n-x)
n = n - x
ans = 0
while True:
new_x = n%x
new_n = n//x
if new_x ==0:
print(ans+x*new_n*3)
exit()
else:
ans = ans + x*new_n*3
n = x
x = new_x | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,628 |
s503683315 | p04048 | u761989513 | 1551136688 | Python | Python (3.4.3) | py | Accepted | 17 | 3064 | 355 | def solve(s, a, b):
if a % b == 0:
return s + ((a // b) * 2 - 1) * b
if b % a == 0:
return s + ((b // a) * 2 - 1) * a
elif a > b:
s += (a // b) * 2 * b
return solve(s, a % b, b)
else:
s += (b // a) * 2 * a
return solve(s, a, b % a)
n, x = map(int, input()... | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,629 |
s963121308 | p04048 | u024809932 | 1551132678 | Python | Python (3.4.3) | py | Accepted | 19 | 2940 | 125 | n, x = map(int, input().split())
def g(a, b):
if a%b == 0:return b
return g(b, a%b)
ans = 3*(n-g(n, x))
print(ans)
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,630 |
s338757392 | p04048 | u077337864 | 1550768777 | Python | Python (3.4.3) | py | Accepted | 17 | 3060 | 131 | def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a%b)
n, x = map(int, input().split())
print(3*(n - gcd(n, x)))
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,631 |
s522572407 | p04048 | u272557899 | 1550639649 | Python | Python (3.4.3) | py | Accepted | 18 | 3064 | 281 | n, x = map(int, input().split())
if (x > n // 2 and n % 2 == 0) or (x > (n + 1) // 2 and n % 2 == 1):
x = n - x
A = n - x
B = x
k = 0
m = -1
ans = n
while m != 0:
k = A // B
m = A % B
ans += B * k * 2
if m == 0:
ans -= B
A = B
B = m
print(ans) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,632 |
s249034321 | p04048 | u926678805 | 1550275369 | Python | Python (3.4.3) | py | Accepted | 18 | 3060 | 220 | import sys
sys.setrecursionlimit(100000)
from math import floor
n,x=map(int,input().split())
ans=0
def f(x,y):
if y%x==0:
return (y//x-1)*2*x+x
return 2*x*(y//x)+f(y%x,x)
print(n+f(min(x,n-x),max(x,n-x))) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,633 |
s876361459 | p04048 | u950708010 | 1550005781 | Python | Python (3.4.3) | py | Accepted | 35 | 5048 | 99 | import fractions
n,x = (int(i) for i in input().split())
ans = fractions.gcd(n,x)
print(3*(n-ans)) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,634 |
s381260099 | p04048 | u020401041 | 1549988001 | Python | Python (3.4.3) | py | Accepted | 17 | 2940 | 259 | N, X = map(int, input().split())
l = 0
if X < N-X:
long = N - X
short = X
else:
long = X
short = N - X
l += N
while True:
l += long // short * short * 2
x = long % short
if x == 0:
l -= short
break
long = short
short = x
print(l) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,635 |
s156822289 | p04048 | u902468164 | 1549754108 | Python | Python (3.4.3) | py | Accepted | 19 | 3060 | 168 | def gcd(a, b):
while b:
a, b = b, a % b
return a
li = [int(i) for i in input().split(" ")]
res = (li[0] // gcd(li[0], li[1]) -1) * 3 * gcd(li[0], li[1])
print(res) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,636 |
s950561751 | p04048 | u201234972 | 1549599140 | Python | Python (3.4.3) | py | Accepted | 18 | 3060 | 232 | N, X = map( int, input().split())
a, b = max(X, N-X), min(X, N-X) #a >= b
ans = a + b
if a == b:
ans += a
while a != b:
if a%b == 0:
ans += (a//b*2-1)*b
break
ans += a//b*2*b
a, b = b, a%b
print(ans)
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,637 |
s410601602 | p04048 | u270681687 | 1549597124 | Python | Python (3.4.3) | py | Accepted | 20 | 3060 | 196 | n, x = map(int, input().split())
# a <= b
def f(a, b):
if b % a == 0:
return (b // a) * 2 * a - a
return (b // a) * a * 2 + f(b % a, a)
print(n + f(min(x, n - x), max(x, n - x))) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,638 |
s598988198 | p04048 | u740284863 | 1549594560 | Python | Python (3.4.3) | py | Accepted | 51 | 5688 | 77 | from fractions import gcd
n,x=map(int,input().split())
print(3*(n-gcd(n,x)))
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,639 |
s783693060 | p04048 | u879870653 | 1549583547 | Python | Python (3.4.3) | py | Accepted | 18 | 3060 | 218 | N,X = map(int,input().split())
def f(a,b) :
if a > b :
a,b = b,a
if b % a == 0 :
return 2*(b//a-1)*a + a
else :
return 2*(b//a)*a + f(a,b%a)
ans = N + f(X,N-X)
print(ans)
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,640 |
s194143299 | p04048 | u631277801 | 1549541181 | Python | Python (3.4.3) | py | Accepted | 18 | 3064 | 777 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**8)
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip(... | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,641 |
s917308530 | p04048 | u761320129 | 1549539876 | Python | Python (3.4.3) | py | Accepted | 18 | 3064 | 172 | N,X = map(int,input().split())
ans = N
a,b = X,N-X
if a>b: a,b = b,a
while a:
d,m = divmod(b,a)
ans += d*a*2
a,b = m,a
if a>b: a,b = b,a
ans -= b
print(ans) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,642 |
s038072391 | p04048 | u638357064 | 1547937150 | Python | Python (3.4.3) | py | Accepted | 17 | 3060 | 250 | # your code goes here
from math import floor
N, X = [int(x) for x in input().split()]
y = N-X
x = X
L = X
while x > 0:
# k = 2*floor(y/x)
k, z = divmod(y, x)
# dL = x*(2*k-1)+y
L += x*(2*k-1)+y
# print(x, y, k, dL)
y, x = (x, z)
#L += y
print(L) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,643 |
s825981109 | p04048 | u690536347 | 1547695604 | Python | Python (3.4.3) | py | Accepted | 18 | 3060 | 200 | import sys
sys.setrecursionlimit(10**7)
def f(a,b):
if a==b:return a
if not a<b:a,b=b,a
return 2*(b//a)*a+f(a,b%a) if b%a else 2*(b//a)*a-a
N,X=map(int,input().split())
print(f(X,N-X)+N) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,644 |
s590590950 | p04048 | u608088992 | 1547164601 | Python | Python (3.4.3) | py | Accepted | 17 | 3064 | 531 | N, X = map(int, input().split())
TotalLength = N
Vert = N-X
Hor = X
Fin = False
while not Fin:
if Vert < Hor:
if Hor % Vert == 0:
TotalLength += (2 * (Hor//Vert) - 1) * Vert
Fin = True
else:
TotalLength += 2 * (Hor//Vert) * Vert
Hor %= Vert
else:
... | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,645 |
s425456402 | p04048 | u846041485 | 1547162158 | Python | Python (3.4.3) | py | Accepted | 18 | 3060 | 171 | n, a = map(int, input().split(' '))
b = n - a
if a < b:
a, b = b, a
ans = n
while b:
q = a // b
ans += 2 * q * b
a %= b
a, b = b, a
ans -= a
print(ans) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,646 |
s573567027 | p04048 | u759434129 | 1546289372 | Python | Python (2.7.6) | py | Accepted | 11 | 2568 | 148 | def f(a, b):
if a > b:
a, b = b, a
if a == 0:
return -b
return 2*(b/a)*a + f(a, b%a)
n, x = map(int, raw_input().split())
print n + f(n-x, x) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,647 |
s957027440 | p04048 | u550943777 | 1546283483 | Python | Python (3.4.3) | py | Accepted | 19 | 3064 | 430 | #最大公約数
def gcd(a,b):
if a==b:
return b
elif a%b== 0:
return b
else:
return gcd(b,a%b)
import math
def func(a,b):
if a<=b :
if b%a != 0:
return 2*math.floor(b/a)*a+func(a,b%a)
else:
return 2*(math.floor(b/a))*a-a
else:
return f... | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,648 |
s106590695 | p04048 | u923279197 | 1546223971 | Python | Python (3.4.3) | py | Accepted | 17 | 3060 | 269 | n,x = map(int,input().split())
ans = 0
if 2*x == n:
ans = 3*x
else:
ans += n
a = x
b = n - x
while True:
ans += (a//b)*2*b
c = b
b = a%b
a = c
if b == 0:
ans -= a
break
print(ans)
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,649 |
s049975237 | p04048 | u761320129 | 1545484929 | Python | Python (3.4.3) | py | Accepted | 17 | 3060 | 153 | N,X = map(int,input().split())
ans = N
a,b = X, N-X
if a > b: a,b = b,a
while b:
d,m = divmod(a,b)
ans += 2*b*d
a,b = b,m
ans -= a
print(ans) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,650 |
s875310760 | p04048 | u624475441 | 1544986824 | Python | Python (3.4.3) | py | Accepted | 18 | 3060 | 248 | N, X = map(int, input().split())
ans = N
a, b = sorted((X, N - X))
while a != 0:
if b % a == 0:
ans += 2 * (b // a - 1) * a + a
print(ans)
break
else:
ans += 2 * (b // a) * a
a, b = sorted((a, b % a)) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,651 |
s574531356 | p04048 | u624475441 | 1544986794 | Python | Python (3.4.3) | py | Accepted | 18 | 2940 | 188 | def f(n, x):
if n % x == 0:
return (n // x * 2 - 1) * x
else:
return (n // x * 2) * x + f(x, n % x)
n, x = map(int,input().split())
ans = n + f(n - x, x)
print(ans) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,652 |
s945542266 | p04048 | u624475441 | 1544946885 | Python | Python (3.4.3) | py | Accepted | 18 | 3060 | 240 | N, X = map(int, input().split())
ans = N
a, b = sorted((X, N - X))
while a != 0:
if b % a == 0:
ans += 2 * (b // a - 1) * a
break
else:
ans += 2 * (b // a) * a
a, b = sorted((a, b % a))
print(ans + a) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,653 |
s884059171 | p04048 | u284854859 | 1543601324 | Python | Python (3.4.3) | py | Accepted | 18 | 3064 | 486 | n,x = map(int,input().split())
res = n
a = x #横
b = n-x #縦
while True:
if a == b:
res += a
break
elif a > b:
k = a//b
c = a%b
if c == 0:
res += (2*k-1)*b
break
else:
res += 2*k*b
a = c
else:
k = b//a
... | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,654 |
s363393018 | p04048 | u258180405 | 1543519758 | Python | Python (3.4.3) | py | Accepted | 18 | 3060 | 292 | """取込"""
n, x = [int(i) for i in input().split(" ")]
"""問題"""
def f(a, b):
# print("({0}, {1})".format(a, b))
l = max(a, b)
s = min(a, b)
if s == 0:
return -l
else:
return (l // s) * s * 2 + f(l % s, s)
d = n + f(n - x, x)
"""出力"""
print(d)
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,655 |
s884455198 | p04048 | u631277801 | 1542292950 | Python | Python (3.4.3) | py | Accepted | 18 | 3064 | 650 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
d... | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,656 |
s746930840 | p04048 | u761320129 | 1542164748 | Python | Python (3.4.3) | py | Accepted | 17 | 3060 | 162 | N,X = map(int,input().split())
a,b = X,N-X
if a > b: a,b = b,a
ans = a+b
while b%a:
ans += b//a * (2*a)
a,b = b%a, a
ans += b//a * (2*a) - a
print(ans) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,657 |
s823058640 | p04048 | u368780724 | 1542139213 | Python | Python (3.4.3) | py | Accepted | 18 | 3060 | 154 | N, X = [int(i) for i in input().split()]
def gcd(a,b):
if b == 0:
return a
return gcd(b,a%b)
scale = gcd(N, X)
print(scale*(N//scale-1)*3) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,658 |
s560410529 | p04048 | u069838609 | 1541800800 | Python | Python (3.4.3) | py | Accepted | 18 | 2940 | 311 | N, X = [int(elem) for elem in input().split()]
total_distance = N
bigger, smaller = N - X, X
while bigger % smaller != 0:
total_distance += 2 * (bigger // smaller) * smaller
bigger, smaller = smaller, bigger % smaller
total_distance += 2 * (bigger // smaller) * smaller - smaller
print(total_distance)
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,659 |
s672198626 | p04048 | u619819312 | 1538927692 | Python | Python (3.4.3) | py | Accepted | 38 | 5304 | 76 | from fractions import gcd
n,m=map(int,input().split())
print(3*(n-gcd(n,m))) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,660 |
s031128088 | p04048 | u536113865 | 1538854703 | Python | Python (3.4.3) | py | Accepted | 42 | 5556 | 105 | ai = lambda: list(map(int,input().split()))
n, x = ai()
from fractions import gcd
print(3*(n-gcd(n,x)))
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,661 |
s208964137 | p04048 | u667024514 | 1538852431 | Python | Python (3.4.3) | py | Accepted | 51 | 5688 | 82 | n,x = map(int,input().split())
import fractions
print(3 * (n-fractions.gcd(n,x)))
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,662 |
s653436499 | p04048 | u177398299 | 1537560789 | Python | Python (3.4.3) | py | Accepted | 17 | 3060 | 174 | N, X = map(int, input().split())
ans = N
a, b = min(X, N - X), max(X, N - X)
while b % a:
ans += 2 * (b // a) * a
a, b = b % a, a
ans += 2 * b // a * a - a
print(ans) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,663 |
s388561573 | p04048 | u111421568 | 1537399038 | Python | Python (3.4.3) | py | Accepted | 17 | 3064 | 277 | n, x = map(int, input().split())
ans = n
longer = max(x, n-x)
shorter = min(x, n-x)
while True:
m = longer // shorter
l = longer % shorter
ans += m*shorter*2
if l == 0:
ans -= shorter
break
longer = shorter
shorter = l
print(ans) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,664 |
s992938186 | p04048 | u115682115 | 1537183051 | Python | Python (3.4.3) | py | Accepted | 40 | 5432 | 78 | from fractions import gcd
N,X = map(int,input().split())
print(3*(N-gcd(N,X))) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,665 |
s373477549 | p04048 | u745087332 | 1536885378 | Python | Python (3.4.3) | py | Accepted | 17 | 3060 | 510 | # coding:utf-8
def inpl(): return list(map(int, input().split()))
n, x = inpl()
def func(a, b):
if a < b:
a, b = b, a
if a == b:
return a
else:
if a % b == 0:
return (a // b * 2 - 1) * b
else:
q, mod = divmod(a, b)
return 2 * q * b + ... | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,666 |
s106788899 | p04048 | u820560680 | 1536519517 | Python | Python (3.4.3) | py | Accepted | 17 | 3060 | 167 | N, X = map(int, input().split())
path = N
a, b = X, N - X
if a < b:
a, b = b, a
while b > 0:
path += b * (a // b) * 2
a, b = b, a % b
path -= a
print(path) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,667 |
s016479656 | p04048 | u218843509 | 1536175131 | Python | Python (3.4.3) | py | Accepted | 17 | 2940 | 148 | n, x = map(int, input().split())
ans = n
n -= x
while n % x != 0:
ans += 2 * (n // x) * x
n , x = x, n % x
ans += 2 * (n // x) * x - x
print(ans)
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,668 |
s517756109 | p04048 | u393481615 | 1535893118 | Python | Python (3.4.3) | py | Accepted | 17 | 2940 | 185 | def gcd(a, b):
if a < b:
a, b = b, a
if b == 0:
return a
c = a % b
return gcd(b, c)
[N, X] = list(map(int, input().split()))
print(int(3*(N-gcd(N,X))))
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,669 |
s010118889 | p04048 | u334712262 | 1534701479 | Python | Python (3.4.3) | py | Accepted | 38 | 5448 | 1,496 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,670 |
s678449031 | p04048 | u620480037 | 1534610173 | Python | Python (3.4.3) | py | Accepted | 17 | 3060 | 311 | N,X=map(int,input().split())
D=N
L=N-X
S=X
if N==2*X:
D=3*X
else:
for i in range(100):
if L%S==0:
D=D+(2*S)*(L//S)-S
break
else:
D=D+(2*S)*(L//S)
A=L
B=S
L=B
S=A%B
#print(D)
print(D) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,671 |
s925701277 | p04048 | u297574184 | 1533268660 | Python | Python (3.4.3) | py | Accepted | 17 | 2940 | 186 | N, X = map(int, input().split())
ans = N
if X >= N - X:
a, b = X, N - X
else:
a, b = N - X, X
while b > 0:
ans += (a // b) * b * 2
a, b = b, a % b
ans -= a
print(ans)
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,672 |
s097083462 | p04048 | u745087332 | 1531530429 | Python | Python (3.4.3) | py | Accepted | 19 | 3188 | 456 | n, x = map(int, input().split())
def func(a, b):
if a < b:
if b%a == 0:
return (b//a*2 - 1)*a
else:
q, mod = divmod(b,a)
return 2*q*a + func(a, mod)
elif a > b:
if a%b == 0:
return (a//b*2 - 1)*b
else:
q, mod = divmod(a... | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,673 |
s329117493 | p04048 | u467736898 | 1530921295 | Python | Python (3.4.3) | py | Accepted | 18 | 2940 | 181 | N, X = map(int, input().split())
def calc(d, c):
q, m = divmod(d, c)
if m == 0:
return (2*q-1)*c
else:
return calc(c, m) + 2*q*c
print(N + calc(X, N-X))
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,674 |
s744869889 | p04048 | u333945892 | 1530671753 | Python | Python (3.4.3) | py | Accepted | 18 | 3064 | 374 | import sys
import heapq
sys.setrecursionlimit(10**8)
#最大公約数
def gcd(a,b):
while b:
a,b = b, a%b
return a
#最小公倍数
def lcm(a,b):
return a*b // gcd(a,b)
N,X = map(int,input().split())
ans = N
a = min(X,N-X)
b = max(X,N-X)
while True: #a<b
n = b//a
ans += n * 2 * a
if n*a == b:
ans -= a
print(ans)
... | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,675 |
s564847838 | p04048 | u388927326 | 1529409527 | Python | Python (3.4.3) | py | Accepted | 22 | 3444 | 453 | #!/usr/bin/env python3
import sys, math, copy
# import fractions, itertools
# import numpy as np
# import scipy
# sys.setrecursionlimit(1000000)
HUGE = 2147483647
HUGEL = 9223372036854775807
ABC = "abcdefghijklmnopqrstuvwxyz"
def gcd(x, y):
if x < y:
x, y = y, x # x >= y
while y > 0:
r = x %... | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,676 |
s904246473 | p04048 | u315078622 | 1528248365 | Python | Python (3.4.3) | py | Accepted | 57 | 5944 | 86 | from fractions import gcd
N, X = map(int, input().split())
print(3 * (N - gcd(N, X)))
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,677 |
s081706181 | p04048 | u476435125 | 1527387059 | Python | Python (3.4.3) | py | Accepted | 18 | 3064 | 224 | lst=list(map(int,input().split()))
#x n-x x x n-2x n-2x n-2x
n=lst[0]
x=lst[1]
#if x==n-x :
# s=
if n-x<=x:
a,b=x,n-x
else:
a,b= n-x,x
s=n
#i=0
while b!=0:
s+=a//b*2*b
c=a
a=b
b=c%b
print(s-a)
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,678 |
s059483215 | p04048 | u761320129 | 1525317852 | Python | Python (3.4.3) | py | Accepted | 17 | 2940 | 132 | N,X = map(int,input().split())
a = X
b = N-X
ans = a+b
while b:
d,m = divmod(a,b)
ans += d*b*2
a,b = b,m
print(ans - a) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,679 |
s815408788 | p04048 | u729707098 | 1525300785 | Python | Python (3.4.3) | py | Accepted | 17 | 3064 | 119 | n,x = (int(i) for i in input().split())
ans,a,b = n,x,n-x
while a%b!=0: ans,a,b = ans+(a//b)*2*b,b,a%b
print(ans+2*a-b) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,680 |
s323609056 | p04048 | u125505541 | 1525297936 | Python | Python (3.4.3) | py | Accepted | 17 | 3064 | 237 | n, x = input().split()
n = int(n)
x = int(x)
ans = 0
a1, a2 = x, n - x
l = min(a1, a2)
h = max(a1, a2)
while True:
d = h // l
ans += 3 * l * d
temp = h - l * d
if temp == 0:
break
h = l
l = temp
print(ans) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,681 |
s488607326 | p04048 | u125505541 | 1524807040 | Python | Python (3.4.3) | py | Accepted | 17 | 3064 | 237 | n, x = input().split()
n = int(n)
x = int(x)
ans = 0
a1, a2 = x, n - x
l = min(a1, a2)
h = max(a1, a2)
while True:
d = h // l
ans += 3 * l * d
temp = h - l * d
if temp == 0:
break
h = l
l = temp
print(ans) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,682 |
s352094560 | p04048 | u341087021 | 1524520696 | Python | Python (3.4.3) | py | Accepted | 17 | 3060 | 221 | n, x = map(int, input().split())
def aaa(a,b):
n = max(a,b)
m = min(a,b)
if n % m == 0:
return 2 * n - m
else:
return 2 * m * int(n / m) + aaa(m, n % m)
ans = n + aaa(n-x, x)
print(ans)
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,683 |
s493921773 | p04048 | u391475811 | 1523899249 | Python | Python (3.4.3) | py | Accepted | 17 | 3060 | 196 | n,x=map(int,input().split())
def solve(a,b):
mi=min(a,b)
ma=max(a,b)
if ma%mi==0:
return (ma//mi*2-1)*mi
else:
return (ma//mi*2)*mi+solve(mi,ma%mi)
ans=n+solve(n-x,x)
print(ans)
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,684 |
s230428310 | p04048 | u562016607 | 1523486671 | Python | Python (3.4.3) | py | Accepted | 17 | 2940 | 121 | def gcd(a,b):
if a%b==0:
return b
else:
return gcd(b,a%b)
N,X=map(int,input().split())
print(3*(N-gcd(N,X)))
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,685 |
s026325424 | p04048 | u075012704 | 1522334138 | Python | Python (3.4.3) | py | Accepted | 17 | 2940 | 126 | N, X = map(int, input().split())
def gcd(a, b):
while b:
a, b = b, a % b
return a
print(3*(N - gcd(N, X))) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,686 |
s908752596 | p04048 | u050024609 | 1519882879 | Python | Python (3.4.3) | py | Accepted | 17 | 2940 | 345 | def gcd(a, b):
while a != b:
if a == 0:
return b
elif b == 0:
return a
if a > b :
a %= b
else:
b %= a
return a
N, X=map(int, input().split())
... | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,687 |
s564873080 | p04048 | u863370423 | 1519299451 | Python | Python (2.7.6) | py | Accepted | 10 | 2568 | 279 | def solve(x, y):
a = max(x, y)
b = min(x, y)
if b == 0:
return 0
res = 2*a
r = solve(b-a % b, a % b)
if r == 0:
res -= b
res += r
return res
s = raw_input().split()
n = int(s[0])
x = int(s[1])
ans = n + solve(x, n-x)
print(ans)
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,688 |
s042058788 | p04048 | u830390742 | 1516806764 | Python | Python (2.7.6) | py | Accepted | 11 | 2568 | 250 | def calc(a, b):
if a <= 0 or b <= 0:
return 0
if a == b:
return a
a, b = min(a, b), max(a, b)
x = max(1, b / (2 * a))
return calc(b-x*a, a) + 2 * a * x
N, X = map(int, raw_input().split())
print calc(X, N-X) + N
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,689 |
s227580815 | p04048 | u086012568 | 1509853275 | Python | Python (2.7.6) | py | Accepted | 10 | 2568 | 146 | n, x = map(int, raw_input().split())
a, b, result = x, n - x, n
while b != 0:
result += 2 * (a // b) * b
a, b = b, a % b
print result - a
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,690 |
s517694570 | p04048 | u536081558 | 1509563514 | Python | Python (2.7.6) | py | Accepted | 11 | 2568 | 114 | n, x = map(int, raw_input().split())
z = n
y = n - x
while y > 0:
z += x / y * y * 2
x, y = y, x % y
print z - x | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,691 |
s389930173 | p04048 | u596276291 | 1505421592 | Python | Python (3.4.3) | py | Accepted | 47 | 5484 | 391 | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from fractions import gcd
from bisect import bisect, bisect_left, bisect_right
INF = 10 ** 10
def main():
N, X = map(int, input().split())
... | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,692 |
s995869480 | p04048 | u325562015 | 1505098294 | Python | Python (3.4.3) | py | Accepted | 17 | 3064 | 278 | def f(a, b):
if a * b == 0:
return 0
res = f(min(a, b), max(a, b) % min(a, b)) + 2 * min(a, b) * (max(a,b)//min(a, b))
if(max(a, b) % min(a, b) == 0):
res -= min(a, b)
return res
n, x = map(int, input().split())
res = n + f(n - x, x)
print(res)
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,693 |
s401564889 | p04048 | u637175065 | 1503068755 | Python | Python (3.4.3) | py | Accepted | 40 | 5456 | 621 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
gosa = 1.0 / 10**10
mod = 10**9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def L... | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,694 |
s618834486 | p04048 | u207056619 | 1502329160 | Python | Python (3.4.3) | py | Accepted | 18 | 3060 | 211 | #!/usr/bin/env python3
def f(n, x):
if n % x == 0:
return (n // x * 2 - 1) * x
else:
return (n // x * 2) * x + f(x, n % x)
n, x = map(int,input().split())
ans = n + f(n - x, x)
print(ans) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,695 |
s529184544 | p04048 | u375536288 | 1499653215 | Python | Python (2.7.6) | py | Accepted | 11 | 2568 | 195 | def gcd(a,b):
if b == 0:
return a
return gcd(b,a%b)
N,k = map(int,raw_input().split())
#k = int(raw_input())
#A = map(int, raw_input().split())
ans = gcd(N,k)
print 3*(N - ans) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,696 |
s085880238 | p04048 | u220248120 | 1498128262 | Python | Python (2.7.6) | py | Accepted | 10 | 2696 | 216 | def solve(a,b):
a,b = max(a,b),min(a,b)
if b == 0:
return 0
res = 2*a
r = solve(b-a%b, a%b)
if r == 0:
res -= b
res += r
return res
n,x = map(int, raw_input().split())
ans = n + solve(x, n-x)
print ans
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,697 |
s206389156 | p04048 | u886545507 | 1482503979 | Python | Python (2.7.6) | py | Accepted | 17 | 2568 | 126 | #ABC001B
def gcd(a, b):
while b:
a, b = b, a % b
return a
n,x=map(int,raw_input().split())
res=3*(n-gcd(n,x))
print res
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,698 |
s467097889 | p04048 | u132291455 | 1478112854 | Python | PyPy2 (5.6.0) | py | Accepted | 41 | 8816 | 116 | n,x=map(int,raw_input().split())
def gcd(i,j):
if j==0:return i
else:return gcd(j,i%j)
print 3*(n-gcd(n,x))
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,699 |
s146543167 | p04048 | u436484848 | 1477343531 | Python | Python (3.4.3) | py | Accepted | 24 | 3064 | 251 | def read():
return [int(i) for i in input().split(" ")]
def calculate(x, y):
if(y % x == 0):
return x * (2 * (y / x) - 1)
else:
return x * 2 * (y // x) + calculate(y % x, x)
(N, X) = read()
length = N + calculate(X, N - X)
print(int(length)) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,700 |
s999658450 | p04048 | u163073599 | 1475179430 | Python | Python (3.4.3) | py | Accepted | 25 | 3064 | 200 | calculate_remainder=lambda pl,pr:2*(pl//pr)*pr-pr if pl%pr==0 else 2*(pl//pr)*pr+calculate_remainder(pr,pl%pr)
n,k=(int(s) for s in input().strip().split(' '))
print(str(n+calculate_remainder(n-k,k))) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,701 |
s973444796 | p04048 | u914627967 | 1472757664 | Python | Python (3.4.3) | py | Accepted | 39 | 3064 | 248 | NX = input()
NX = "".join(NX).split(" ")
NX = [int(s) for s in NX]
N =NX[0]
X =NX[1]
D = NX[0]-NX[1]
A=X+D
def ans(x,y):
global A
if x%y==0:
A+=2*y*(x/y)-y
return print(int(A))
A +=int(x/y)*y*2
ans(y,x%y)
if X>D:
ans(X,D)
else: ans(D,X)
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,702 |
s159971476 | p04048 | u552668967 | 1472440929 | Python | Python (2.7.6) | py | Accepted | 28 | 2568 | 139 | from sys import stdin
n,k = map(int,stdin.readline().split())
def gcd(a,b):
while a%b:
t = a%b; a=b; b=t
return b
print (n-gcd(n,k))*3 | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,703 |
s271494491 | p04048 | u813356465 | 1471659122 | Python | Python (3.4.3) | py | Accepted | 41 | 3188 | 222 | N, x = [int(s) for s in input().split()]
l = N
n = max(x,N-x)
x = min(x,N-x)
while (True):
q = n // x
r = n % x
if r == 0:
print(l + (2*q-1)*x)
break
l += (2*q)*x
n = x
x = r | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,704 |
s463592337 | p04048 | u215553237 | 1470814441 | Python | Python (3.4.3) | py | Accepted | 39 | 3064 | 111 | N, X = map(int, input().split())
def f(a, b):
return 2*a*(b//a) + f(b%a, a) if a else -b
print(N + f(N-X, X))
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,705 |
s579936565 | p04048 | u226155577 | 1469394658 | Python | Python (2.7.6) | py | Accepted | 27 | 2568 | 196 | n, x = map(int, raw_input().split())
ans = x
while 0 < x < n:
k = x / (n-x)
rest = x % (n-x)
ans += 2*k*(n-x)
if rest:
ans += n-x + rest
n, x = n-x, n-x-rest
print ans
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,706 |
s841274627 | p04048 | u824587292 | 1469212748 | Python | Python (2.7.6) | py | Accepted | 27 | 2568 | 233 | a,b=map(int,raw_input().split())
t,n,m=a-b,b,a
ans=b
while 1:
if n<m:
ans+=t
t,n,m=n,t,t
elif n%t==0:
ans+=n*2-t
break
else:
s=n+m
n,m=n%t,m%t+t
ans+=s-n-m
print ans | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,707 |
s972682763 | p04048 | u330623252 | 1468862592 | Python | Python (2.7.6) | py | Accepted | 29 | 2568 | 235 | N, X = map(int, raw_input().split())
def f(a, b):
if a == 0:
return -b
elif b == 0:
return -a
elif a < b:
return f(a, b % a) + (b / a) * 2 * a
else:
return f(a % b, b) + (a / b) * 2 * b
print N + f(X, N - X)
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,708 |
s083263107 | p04048 | u804080968 | 1468809777 | Python | Python (3.4.3) | py | Accepted | 51 | 3684 | 160 | N, X = map(int, input().split())
ans = N
N -= X
while X > 0:
N, X = max(N, X), min(N, X)
ans += N // X * X * 2
N, X = X, N % X
ans -= N
print(ans)
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,709 |
s457453370 | p04048 | u098968285 | 1468807216 | Python | Python (3.4.3) | py | Accepted | 39 | 3064 | 268 | N, X = map(int, input().split())
Y = N - X
ans = N
while True:
if X == Y:
ans += X
break
else:
if X > Y:
tmp = X
X = Y
Y = tmp
a = Y % X
b = Y // X
if a == 0:
ans += (b*2 - 1) * X
break
else:
ans += b*2*X
Y = X
X = a
print(ans)
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,710 |
s098736322 | p04048 | u060392346 | 1468784626 | Python | Python (2.7.6) | py | Accepted | 28 | 2568 | 249 | n, x = map(int, raw_input().split())
s = n
r = 1
if n - x > x:
a, b = n - x ,x
else:
a, b = x, n - x
while r > 0:
q = a / b
r = a % b
if r > 0:
s += 2 * q * b
else:
s += (2 * q - 1) * b
a, b = b, r
print s | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,711 |
s857540639 | p04048 | u819161081 | 1468778513 | Python | Python (2.7.6) | py | Accepted | 29 | 2568 | 142 | N,X = map(int,raw_input().split(' '))
l = 0
N, X = max(X,N-X), min(X,N-X)
while True:
l += (N/X)*X*3
if N%X==0: break
N, X = X, N%X
print l | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,712 |
s950565486 | p04048 | u382423941 | 1468768874 | Python | Python (3.4.3) | py | Accepted | 43 | 3064 | 117 | n, x = map(int, input().split())
ans, e = n, n-x
while x > 0:
ans += x * (e//x*2)
e, x = x, e%x
print(ans-e)
| p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,713 |
s242890706 | p04048 | u557523358 | 1468767621 | Python | Python (3.4.3) | py | Accepted | 39 | 3064 | 165 | def f(a, b):
a, b = min(a, b), max(a, b)
return (b // a) * 2 * a + (f(a, b % a) if b % a > 0 else -a)
n, x = map(int, input().split())
print(f(x, n - x) + n) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,714 |
s942798286 | p04048 | u620084012 | 1468756398 | Python | Python (3.4.3) | py | Accepted | 42 | 3064 | 135 | N, X = map(int,input().split())
ans = N
u = N-X
d = X
while(d!=0):
ans += d*(u//d)*2
t = u
u = d
d = t%d
print(ans-u) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,715 |
s252832086 | p04048 | u399560160 | 1468741240 | Python | Python (3.4.3) | py | Accepted | 76 | 5308 | 84 | from fractions import gcd
n, k = map(int, input().split(' '))
print(3*(n-gcd(n, k))) | p04048 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of <em>Mysterious Light</em>.</p>
<p>Three mirrors of length <var>N</var> are set so that they form an equilatera... | 5 2
| 12
| 1,217,716 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.