submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s537969517
p04048
Wrong Answer
N, X = map(int, raw_input().split()) ans = 0 if N%2 ==0: ans = (N-X)*3 else: ans = (N-1)*3 print(ans)
5 2
12
<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...
s613923011
p04048
Wrong Answer
import math N,X = (int(_) for _ in input().split()) def light(N,X): if (X >= N / 2): return 3 * X return 3 * (math.ceil((N - 2 * X) / X) + 1) * X print (light(N,X))
5 2
12
<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...
s411564713
p04048
Wrong Answer
#! /usr/bin/env python3 N, X = map(int, input().split()) if X*2 == N: print(X*3) else: print(X*3*((N-X)//X + (1 if (N-X)%X>0 else 0)))
5 2
12
<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...
s542092187
p04048
Wrong Answer
n, x = map(int, raw_input().split()) s = 3 * (n - 1) if n % 2 == 0: s = 3 * (n / 2 + abs(n / 2 - x)) print s
5 2
12
<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...
s178450829
p04048
Wrong Answer
import math N,X = (int(_) for _ in input().split()) def light(N,X): if (X >= N / 2): return 3 * X return 3 * (math.ceil((N - 2 * X) // X) + 1) * X print (light(N,X))
5 2
12
<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...
s988710332
p04048
Wrong Answer
n,x=map(int,input().split()) if n%2==0: print(int(n/2*3 + abs(n/2-x)*3)) else: print((n-1)*3)
5 2
12
<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...
s701022204
p04048
Wrong Answer
N,X = map(int,raw_input().split()) if N % 2 == 0: print (abs(X-N/2)+N/2) * 3 else: print (N - 1) * 3
5 2
12
<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...
s672417796
p04048
Wrong Answer
#!/usr/bin/env python # -*- coding: utf-8 -*- def main(): n, x = [int(i) for i in input().split()] result = n + (x * 2) + (x // 2) * 3 print(result) if __name__ == '__main__': main()
5 2
12
<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...
s900992225
p04048
Wrong Answer
import math def inp(): return int(raw_input()) def linp(): return map(int, raw_input().split()) n, x = map(int, raw_input().split()) print 4*(n-x)
5 2
12
<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...
s217359823
p04048
Wrong Answer
n,m=map(int,input().split()) if n%2==0: print(n/2*3 + abs(n/2-x)*3) else: print((n-1)*3)
5 2
12
<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...
s875948711
p04048
Wrong Answer
N, X = map(int, raw_input().split()) if 3 * X - N < 0: print 3 * (N - X) elif N - 2 * X > 0: print 6 * X else: print 3 * N
5 2
12
<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...
s491698138
p04048
Wrong Answer
n, x = map(int,input().split()) if n == 2: ans = 3 elif n % 2 == 1: ans = (n-1) * 3 else: if x > n//2: x = n - x std = (n//2) * 3 ans = std + (n//2 - x) * 3 print(ans)
5 2
12
<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...
s129327256
p04048
Wrong Answer
import math def inp(): return int(raw_input()) def linp(): return map(int, raw_input().split()) n, x = map(float, raw_input().split()) print int(n+2*x+(x/2)*3)
5 2
12
<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...
s723899026
p04048
Wrong Answer
N,X = map(int,input().split()) Ans = 4 * N - 4 * X print(Ans)
5 2
12
<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...
s491297580
p04048
Wrong Answer
L = input().split() n=int(L[0]) x=int(L[1]) val = int(x+(n-x)+x+x+3*(x/2)) print(val)
5 2
12
<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...
s071824305
p04048
Wrong Answer
import math def inp(): return int(raw_input()) def linp(): return map(int, raw_input().split()) n, x = map(float, raw_input().split()) print n+2*x+(x/2)*3
5 2
12
<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...
s961041037
p04048
Wrong Answer
N, X = map(int, input().split()) if N % X != 0: print(N * 3 - 3) else: print((N - min(X, N - X)) * 3)
5 2
12
<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...
s485931248
p04048
Wrong Answer
N, X = map(int,input().split()) if N == X*2: print(X*3) else: print(3*(N-1))
5 2
12
<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...
s992683015
p04048
Wrong Answer
n, x = map(int,input().split()) ans = (n-1) * 3 print(ans)
5 2
12
<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...
s387903559
p04048
Wrong Answer
N, X = map(int,input().split()) print(3*(N-1))
5 2
12
<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...
s322539119
p04048
Wrong Answer
N, X = map(int, input().split()) print(N * 3 - 3)
5 2
12
<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...
s783037158
p04048
Wrong Answer
N, X = map(int, raw_input().split()) if N - 2 * X > 0: print 4 * (N - X) else: print 3 * N
5 2
12
<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...
s835075904
p04048
Wrong Answer
print 3*(int(raw_input().split()[0])-1)
5 2
12
<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...
s068938215
p04048
Time Limit Exceeded
N, X = list(map(int, input().split())) ans = N N = N - X while N: if X < N: ans += X * 2 N, X = X, N - X else: d, m = divmod(N, X) ans += d * X + m * 2 N, X = m, X - m print(ans)
5 2
12
<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...
s117184266
p04048
Time Limit Exceeded
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) n, x = map(int, input().split()) ans = 0 ans += n l1, l2 = min(n - x, x), max(n - x, x) #while True: # if l1 == l2: # ans += l1 # break # else: # ans += (l1 * 2) # l1, l2 = min(l1, l2 -l1), max(l1, l2 - l1) while T...
5 2
12
<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...
s917855377
p04048
Time Limit Exceeded
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) n, x = map(int, input().split()) ans = 0 ans += n l1, l2 = min(n - x, x), max(n - x, x) while True: if l1 == l2: ans += l1 break else: ans += (l1 * 2) l1, l2 = min(l1, l2 -l1), max(l1, l2 - l1) print(ans)
5 2
12
<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...
s268620606
p04048
Time Limit Exceeded
import os import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10 ** 9) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 # MOD = 998244353 N, K = list(map(int, sys.stdin.buffer.readline().split())) a = K b = N - K c = 0 d = min(a, b) while not a == b == c: a, b, c = s...
5 2
12
<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...
s397940061
p04048
Time Limit Exceeded
import os import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10 ** 9) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 # MOD = 998244353 N, K = list(map(int, sys.stdin.buffer.readline().split())) a = K b = N - K c = 0 d = min(a, b) while not a == b == c: a, b, c = s...
5 2
12
<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...
s811459675
p04048
Time Limit Exceeded
N, X = map(int, input().split(" ")) ans = N N -= X while(True): if N%X==0: ans += (N*2-X) break else: ans += X*2 N = N - X if N < X: tmp = N N = X X = tmp print(ans)
5 2
12
<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...
s455362507
p04048
Time Limit Exceeded
N, X = map(int, input().split(" ")) ans = X count = 0 while(True): if count == 0: ans = ans + N - X N -= X if N < X: tmp = N N = X X = tmp count = 1 elif count == 1: if N%X == 0: ans += (N*2-X) break else: ans = ans + X X = N-X if N < X: ...
5 2
12
<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...
s473977641
p04048
Time Limit Exceeded
N, X = map(int, input().split(" ")) ans = X count = 0 while(True): if count == 0: ans = ans + N - X N -= X if N < X: tmp = N N = X X = tmp count = 1 elif count == 1: ans = ans + X X = N-X if N < X: tmp = N N = X X = tmp count = 0 if X == 0: b...
5 2
12
<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...
s993619459
p04048
Time Limit Exceeded
n, x = map(int, input().split()) ans = n y, x = n-x, x while y != x: if x > y: y, x = x, y ans += 2*x y, x = y-x, x ans += x print(ans)
5 2
12
<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...
s614400268
p04048
Time Limit Exceeded
N, X = map(int, input().split()) hei = [X, N - X] distance = N while hei[0] != hei[1]: if hei[0] > hei[1]: distance += 2 * hei[1] hei[0] = hei[0]- hei[1] else: distance += 2 * hei[0] hei[1] = hei[1] - hei[0] distance += hei[0] print(distance)
5 2
12
<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...
s965445230
p04048
Time Limit Exceeded
N, X = map(int, input().split()) ans = N a = N - X b = X while a != b: if a >= b: a, b = b, a if b%a != 0: ans += 2 * a * (b//a) b = b%a else: ans += 2 * a b = b - a print (ans + a)
5 2
12
<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...
s612671005
p04048
Time Limit Exceeded
# import sys # sys.setrecursionlimit(10 ** 9) N, X = map(int, input().split()) # def f(a, b): # if a == b: # return a # if a >= b: # a, b = b, a # return 2 * a + f(a, b - a) # print (N + f(N - X, X)) ans = N a = N - X b = X while a != b: if a >= b: a, b = b, a ans += 2 ...
5 2
12
<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...
s685218700
p04048
Time Limit Exceeded
N,X = map(int,input().split()) x = X y = N-X res = N while 1: if x==y: res += x break if x > y: x,y = y,x res += x*2 y -= x print(res)
5 2
12
<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...
s425518916
p04048
Time Limit Exceeded
N, X = map(int, input().split(" ")) e_long = max(X, N-X) e_short = N - e_long total = N while e_long != e_short and e_long > 0 and e_short > 0: total += e_short * 2 e_long -= e_short if e_short > e_long: tmp = e_long e_long = e_short e_short = tmp total += e_short print(total)
5 2
12
<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...
s164608264
p04048
Time Limit Exceeded
n,x= list(map(int,input().split(" "))) y = n-x s = n while x!=y: if x>y: s +=2* y x -=y else: s += 2*x y -=x s+=x print( s)
5 2
12
<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...
s461006299
p04048
Time Limit Exceeded
input_word = input() tmp_list = input_word.split(" ") N = int(tmp_list[0]) Y = int(tmp_list[1]) * 2 - 1 output = [[ 0 for i in range(2*N) ] for j in range(2*N)] X = 0 flag = 1 output[Y][X] = 1 while True: if flag == 1: if Y == 2*X + 1: if output[Y+1][Y+1] == 0: Y, X = Y+1, Y+1 flag = 2 ...
5 2
12
<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...
s283621889
p04048
Time Limit Exceeded
import numpy as np s = list(map(int, input().split())) l = s[0] while True: tmp = s[0] s[0] = s[1] s[1] = tmp - s[1] s = np.sort(s)[::-1] if s[0] == s[1]: l += s[0] break else: l = l + s[1] * 2 print(l)
5 2
12
<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...
s213711260
p04048
Time Limit Exceeded
n,x = map(int,input().split()) if 2 * x == n: print(3 * x) exit() elif 2 * x < n: res = 2 * x + n a,b = sorted([x,n-2*x]) else: res = n a,b = n-x, x while a!=b: res += a * 2 a,b = sorted([a,b-a]) print(res+a)
5 2
12
<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...
s435175728
p04048
Time Limit Exceeded
S=input() A=S.split() N=int(A[0]) X=int(A[1]) Suma=0 Suma=Suma+X Bx=X By=N-X Suma=Suma+By while (Bx%By!=0): Path=int(Bx/By) Suma=Suma+By*(2*Path) Res=Bx%By Suma=Suma+2*Res Bx=Res By=By-Res Suma=Suma+By*(2*Bx/By-1) print(int(Suma))
5 2
12
<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...
s667118656
p04048
Time Limit Exceeded
#!/usr/bin/env python3 import sys def debug(*args): print(*args, file=sys.stderr) def exit(): sys.exit(0) sys.setrecursionlimit(100000) N, X = map(int, input().split()) def f(x, n): if x == 0 or x == n: return 0 debug(x,n) # if 2*x == n: # return 3*x if x % (n-x) == 0: return ...
5 2
12
<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...
s038836774
p04048
Time Limit Exceeded
#!/usr/bin/env python3 import sys def debug(*args): print(*args, file=sys.stderr) def exit(): sys.exit(0) sys.setrecursionlimit(100000) N, X = map(int, input().split()) def f(x, n): debug(x,n) # if 2*x == n: # return 3*x if x % (n-x) == 0: return 3*x if 2*x < n: return f(x, n-...
5 2
12
<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...
s007882360
p04048
Time Limit Exceeded
def gcd(a, b): while a != b: if a > b : a -= b else: b -= a return a N, X=map(int, input().split()) print(3*(N - gcd(N, X)))
5 2
12
<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...
s433743441
p04048
Time Limit Exceeded
L = map(int, raw_input().split()) n = L[0] x = L[1] res = n a = x b = n-x flag = True while flag : if a > b: a -= b res += 2*b elif b > a: b -= a res += 2*a else: res += a flag = False print(res)
5 2
12
<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...
s794173856
p04048
Time Limit Exceeded
n, x = map(int, raw_input().split()) s = [x, n-x, n-x, n] ans = x s.sort() while not(s[0] == s[3]): dup = set([x for x in s if s.count(x) > 1]) if (len(dup) == 1): elem = dup.pop() s[3] -= elem ans += elem s.sort() else: s[2] -= s[0] ans += s[0] s.sort...
5 2
12
<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...
s830390219
p04048
Time Limit Exceeded
from numpy import array N,X=list(map(int,input().split())) ''' M[i段目][左からj] 0.右 (i,j+1) 1.左上 (i-1,j-1) 2.右上 (i-1,j+1) 3.左下(i+1,j) 4.右下(i+1,j+1) ''' M =[[array([0,0]) for _ in range(n+1)] for n in range(N+1)] #print(M) #start M[X][0] pos = array([X,0]) ans = 0 dist = array([0,1]) while not( ans and pos[0]==X and pos...
5 2
12
<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...
s786747647
p04048
Time Limit Exceeded
(N, X) = tuple([int(term) for term in input().split()]) T = N A = N - X B = X while (True) : if (B == 0) : break n = int(A / B) if (A % B == 0) : T += (2 * n - 1) * B break T += 2 * n * B + 2 * (A % B) a = A % B b = B - (A % B) A = a B = b print(T)
5 2
12
<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...
s958352803
p04048
Time Limit Exceeded
n, x = map(int,input().split()) if n % 2 == 0 and n//2 == x: print(3 * x) exit() if x > n // 2: x = n - x xx = x yy = n - x ans = n i = 0 f = False while True: if yy >= xx: ans += 2 * xx yy -= xx if yy == 0: ans -= xx f = True break ...
5 2
12
<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...
s687136788
p04048
Time Limit Exceeded
n, x = map(int, input().split(' ')) ans = n c = [x, n-x] while (c[0] != c[1]): ans += 2 * min(c) c = [min(c), max(c)-min(c)] print(ans+c[0])
5 2
12
<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...
s305684111
p04048
Time Limit Exceeded
n, x = map(int,input().split()) if n % 2 == 0 and n//2 == x: print(3 * x) exit() if x > n // 2: x = n - x xx = x yy = n - x ans = n i = 0 f = False while True: if yy >= xx: ans += 2 * xx yy -= xx if yy == 0: ans -= xx f = True break ...
5 2
12
<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...
s267125892
p04048
Time Limit Exceeded
N,X=map(int,input().split()) A=N X,N = sorted((X,N-X)) while N != X: A += 2*X X,N=sorted((X,N-X)) print(A+X)
5 2
12
<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...
s489006563
p04048
Accepted
n, x = map(int, input().split()) a = max(n-x, x); b = min(n-x, x) res = n while b!=0: p=a; q=int(a/b); r=a%b res+=q*(2*b) if r==0: res-=b a=b; b=r print(res)
5 2
12
<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...
s375714517
p04048
Accepted
n,x=map(int,input().split()) def f(a,b): if a>b: b,a=a,b if b%a==0: return (2*(b//a)-1)*a return 2*a*(b//a)+ f(b%a,a) print(n+ f(x,n-x))
5 2
12
<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...
s096161027
p04048
Accepted
N, X = list(map(int, input().split())) ans = N N, X = X, N - X while N and X: if X > N: d, m = divmod(X, N) if m == 0: ans += (d * 2 - 1) * N else: ans += d * 2 * N N, X = N, m else: d, m = divmod(N, X) if m == 0: ans += (d * 2 - 1) * X else: ans += d * 2 * X + m...
5 2
12
<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...
s109261748
p04048
Accepted
import math n, x = map(int, input().split()) print(3 * (n - math.gcd(n, x)))
5 2
12
<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...
s276715694
p04048
Accepted
N, X = map(int, input().split()) def func(X, Y): if X < Y: return func(Y, X) # X>=Y if X % Y == 0: return 2*X-Y else: return 2*Y*(X//Y) + func(Y, X % Y) ans = N + func(X, N-X) print(ans)
5 2
12
<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...
s073001618
p04048
Accepted
n,x = map(int,input().split()) ans = n e = n-x while e > 0: if x%e == 0: ans += x//e*(e*2)-e else: ans += (x//e)*e*2 x,e = e,x%e print(ans)
5 2
12
<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...
s052772062
p04048
Accepted
n,x = map(int,input().split()) ans = n e = n-x count = 0 while True: if x%e == 0: ans += x//e*(e*2)-e break else: ans += (x//e)*e*2 x,e = e,x%e count += 1 print(ans)
5 2
12
<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...
s001893091
p04048
Accepted
n, x = map(int, input().split()) def func(a, b): if b == 0: return -a else: return 2 * (a // b) * b + func(b, a%b) print(n + func(max(n-x, x), min(n-x, x)))
5 2
12
<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...
s245813452
p04048
Accepted
n, x = map(int, input().split()) def func(a, b): if a < b: a, b = b, a res = 0 while b > 0: c, d = divmod(a, b) res += 2 * b * c a = b b = d return res - a print(n + func(x, n-x))
5 2
12
<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...
s981932092
p04048
Accepted
n, x = map(int, input().split()) def func(a, b): res = 0 while b > 0: c, d = divmod(a, b) res += 2 * b * c a = b b = d return res - a print(n + func(x, n-x))
5 2
12
<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...
s411200306
p04048
Accepted
n, x = map(int, input().split()) def func(a, b): res = 0 while b > 0: c, d = divmod(a, b) res += 2 * b * c a = b b = d return res - a if n == 2 * x: print(3 * x) elif n > 2 * x: print(n + 2 * x + func(max(x, n-2*x), min(x, n-2*x))) else: print(n + func(x, n...
5 2
12
<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...
s543440589
p04048
Accepted
from math import * n,x=map(int,input().split()) print(3*(n-gcd(n,x)))
5 2
12
<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...
s760064126
p04048
Accepted
import math n,x = map(int, input().split()) t = math.gcd(n,x) print(3*(n//t-1)*t)
5 2
12
<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...
s314848377
p04048
Accepted
import sys sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): n, x = map(int, input().split()) n -= x res = 0 while x != 0: q, r = divmod(n, x) res += q * x * 3 n = x x = r print(res) if __name__ == '__...
5 2
12
<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...
s943853722
p04048
Accepted
def gcd(a,b): if b == 0: return a return gcd(b,a%b) def solve(n,x): res = 3 * (n - gcd(n,x)) return res if __name__ == '__main__': n,x = map(int,input().split()) print(solve(n,x))
5 2
12
<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...
s219539227
p04048
Accepted
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) n, x = map(int, input().split()) ans = 0 ans += n l1, l2 = min(n - x, x), max(n - x, x) #while True: # if l1 == l2: # ans += l1 # break # else: # ans += (l1 * 2) # l1, l2 = min(l1, l2 -l1), max(l1, l2 - l1) #while ...
5 2
12
<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...
s867386075
p04048
Accepted
import math n, x = map(int, input().split()) print(3 * (n - math.gcd(n, x)))
5 2
12
<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...
s873681630
p04048
Accepted
n, x = map(int, input().split()) def f(a, b): if a == b: return a if a > b: a, b = b, a if b % a == 0: return 2 * b - a else: div, mod = divmod(b, a) return 2 * a * div + f(a, mod) print(n + f(n-x, x))
5 2
12
<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...
s152005424
p04048
Accepted
import math n,x=map(int,input().split()) print(3*(n-math.gcd(n,x)))
5 2
12
<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...
s028636405
p04048
Accepted
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") n,x = map(int, input().split()) v0 = n v1 = n-x ans = x init = 0 while True: num, amari = divmod(v0,v1) # print(ans, v0,v1) if amari==0: ans += (2*(num-1)+in...
5 2
12
<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...
s157369906
p04048
Accepted
N, X = [int(x) for x in input().split()] def solution(N, X): if N<X: N, X = X, N if not N % X: return (2*(N//X) -1) * X else: return 2*(N//X)*X + solution(X, N%X) answer = solution(N-X, X) + N print(answer)
5 2
12
<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...
s323769427
p04048
Accepted
N,X = input().split() N,X = int(N), int(X) answer = X+ (N-X) def rhombus(N,X): if X==1: return N*2-1 if X==0: return 0 if N%X == 0: return X*(N//X)*2-X else: k = N//X return k*2*X + rhombus(X,N-(k*X)) answer = answer + rhombus(N-X,X) print...
5 2
12
<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...
s690311569
p04048
Accepted
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def f(a, b): if a == 0 or b == 0: return 0 if a > b: q, r = divmod(a, b) return 2*q*b + f(a % b, b) else: return a+b+f(b-a, a) N, X = map(int, read().split()...
5 2
12
<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...
s119118281
p04048
Accepted
def Z(): return int(input()) def ZZ(): return [int(_) for _ in input().split()] def main(): N, X = ZZ() N -= X ans = 0 while True: ans += (N//X) * 3 * X #割り切れない if N%X: N, X = X, N%X #割り切れる else: break print(ans) return if __name__ == '__main__': ma...
5 2
12
<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...
s665459283
p04048
Accepted
N,X = map(int,input().split()) res = N a,b = max(N-X,X),min(N-X,X) while b: q = a // b r = a % b res += (b*2)*q if r == 0: res -= b a,b = b,r print(res)
5 2
12
<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...
s132432380
p04048
Accepted
n, x = map(int, input().split()) def f(a, b): if (a > b): a, b = b, a if b % a == 0: return (b // a * 2 - 1) * a return b // a * 2 * a + f(b % a, a) print(n + f(x, n - x))
5 2
12
<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...
s109229200
p04048
Accepted
n,x=map(int,input().split()) ans=n n-=x n,x=max(n,x),min(n,x) ans+=2*(n//x)*x n%=x n,x=x,n while x: ans+=2*(n//x)*x n%=x n,x=x,n print(ans-n)
5 2
12
<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...
s454318805
p04048
Accepted
N,X = map(int,input().split()) def gcd(a,b): if b == 0: return a else: return gcd(b,a%b) ans = 3*(N-gcd(N,X)) print(ans)
5 2
12
<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...
s120354281
p04048
Accepted
n, x = map(int, input().split()) a, b = max(n - x, x), min(n - x, x) ans = a + b while b > 0: ans += (a // b) * b * 2 a, b = b, a % b print(ans - a)
5 2
12
<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...
s833124110
p04048
Accepted
import sys def reflect(A, B): if A > B: A, B = B, A ref = B // A if B % A == 0: return (ref * 2 - 1) * A else: return ref * 2 * A + reflect(B % A, A) N, X = map(int, sys.stdin.readline().rstrip().split()) print(N + reflect(X, N - X))
5 2
12
<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...
s296553858
p04048
Accepted
n, x = map(int, input().split()) a = n - x b = x ans = 0 while b: d, m = divmod(a, b) ans += d * b * 3 a = b b = m print(ans)
5 2
12
<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...
s501226448
p04048
Accepted
import math N, X = list(map(int, input().split(' '))) def f(a, b): a, b = min([a, b]), max([a, b]) if b % a == 0: return 2 * a * math.floor(b / a) - a return 2 * a * math.floor(b / a) + f(a, b % a) print(N + f(N - X, X))
5 2
12
<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...
s185286677
p04048
Accepted
def GCD(x, y): if y == 0: return x return GCD(y, x % y) if __name__ == "__main__": N, X = map(int, input().split()) ans = 3 * (N - GCD(N, X)) print(ans)
5 2
12
<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...
s394892081
p04048
Accepted
N, X = map(int, input().split()) if X * 2 == N: ans = 3 * X else: ans = 0 if X * 2 < N: LL = N - X SS = X else: LL = X SS = N - X while True: div, mod = divmod(LL, SS) ans += 3 * SS * div if mod == 0: break LL = SS ...
5 2
12
<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...
s258543943
p04048
Accepted
import os import sys if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10 ** 9) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 # MOD = 998244353 N, K = list(map(int, sys.stdin.buffer.readline().split())) a = K b = N - K c = 0 d = min(a, b) while not a == b == c: a, b, c = ...
5 2
12
<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...
s512598794
p04048
Accepted
import sys input = sys.stdin.readline N, X = map(int, input().split()) def solve(n, x): #print(n, x) if n == 0: return 0 if x == 1: return n * 3 m = x y = n - n // x * x if y == 0: return n // x * x * 3 return solve(m, y) + n // x * x * 3 print(solve(max(N - X, X), min(N - X, X)))
5 2
12
<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...
s297591090
p04048
Accepted
import sys input = sys.stdin.readline def f(a, b): if b % a == 0: return b // a * 2 * a - a return 2 * (b // a) * a + f(b % a, a) def main(): N, X = map(int, input().split()) print(N + f(X, N-X)) if __name__ == '__main__': main()
5 2
12
<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...
s193725428
p04048
Accepted
from collections import deque from heapq import heapify,heappop,heappush,heappushpop from copy import copy,deepcopy from itertools import permutations,combinations from collections import defaultdict,Counter # from math import gcd # from fractions import gcd from functools import reduce from pprint import pprint def m...
5 2
12
<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...
s432858311
p04048
Accepted
N, X = map(int, input().split()) def f(a, b): if b % a == 0: return b // a * 2 * a - a return b //a * 2 * a + f(b% a, a) ans = N + f(X, N-X) print(ans)
5 2
12
<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...
s757234374
p04048
Accepted
n,x=map(int,input().split()) a=max(n-x,x) b=min(n-x,x) s=n while b!=0: c=a//b d=a%b s+=2*b*c if d==0: s-=b a=b b=d print(s)
5 2
12
<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...
s548549815
p04048
Accepted
N, X = map(int, input().split()) a = max(N - X, X) b = min(N - X, X) ans = N while b != 0: q = a // b r = a % b ans += 2 * b * q if r == 0: ans -= b a = b b = r print(ans)
5 2
12
<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...
s725581679
p04048
Accepted
def gcd(a,b): while b:a,b = b,a%b return a def main(): N,X = map(int,input().split()) print(3*(N-gcd(N,X))) if __name__ == "__main__": main()
5 2
12
<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...
s799860145
p04048
Accepted
def examA(): N = I() L = LI() L.sort() ans = sum(L[::2]) print(ans) return def examB(): def gcd(x, y): if y == 0: return x while (y != 0): x, y = y, x % y return x N, X = LI() ans = 3*(N - gcd(N-X,X)) print(ans) return def exa...
5 2
12
<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...
s287936328
p04048
Accepted
n , x = map(int,(input().split())) a , b = n-x , x ans = n while True: c = max(a,b) d = min(a,b) if c % d != 0: ans += (c // d) * 2 * d else: ans += ((c // d) * 2 - 1) * d break a = d b = c%d print(ans)
5 2
12
<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...
s311004697
p04048
Accepted
# 解説AC N, X = map(int, input().split()) ans = N a, b = max(N - X , X), min(N - X, X) # Euclidの互除法 while b: q, r = divmod(a, b) ans += (b * 2) * q if r == 0: ans -= b # 最後 a, b = b, r print(ans)
5 2
12
<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...
s481092686
p04048
Accepted
import fractions N, X = map(int,input().split()) GCD = fractions.gcd(N, X) print(GCD*3*(N//GCD-1))
5 2
12
<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...
s971388703
p04048
Accepted
N,X=map(int, input().split()) ans=X R,E=X,N-X while True: ans+=R//E*E*2 R-=R//E*E if not R: break ans+=E+R R,E=E-R,R print(ans)
5 2
12
<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...