結果

問題 No.186 中華風 (Easy)
ユーザー pluto77pluto77
提出日時 2016-04-14 14:57:04
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 311 ms / 2,000 ms
コード長 423 bytes
コンパイル時間 305 ms
コンパイル使用メモリ 77,664 KB
実行使用メモリ 78,756 KB
最終ジャッジ日時 2023-09-27 00:48:48
合計ジャッジ時間 4,950 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 267 ms
78,532 KB
testcase_01 AC 107 ms
78,400 KB
testcase_02 AC 157 ms
78,412 KB
testcase_03 AC 79 ms
78,492 KB
testcase_04 AC 139 ms
78,680 KB
testcase_05 AC 155 ms
78,608 KB
testcase_06 AC 258 ms
78,496 KB
testcase_07 AC 133 ms
78,496 KB
testcase_08 AC 162 ms
78,412 KB
testcase_09 AC 157 ms
78,576 KB
testcase_10 AC 311 ms
78,716 KB
testcase_11 AC 193 ms
78,604 KB
testcase_12 AC 95 ms
78,632 KB
testcase_13 AC 195 ms
78,580 KB
testcase_14 AC 102 ms
78,708 KB
testcase_15 AC 85 ms
78,692 KB
testcase_16 AC 188 ms
78,756 KB
testcase_17 AC 90 ms
78,492 KB
testcase_18 AC 118 ms
78,416 KB
testcase_19 AC 76 ms
77,292 KB
testcase_20 AC 74 ms
77,432 KB
testcase_21 AC 75 ms
77,072 KB
testcase_22 AC 75 ms
77,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
#yuki_186
import sys

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

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


x1,y1=map(int,raw_input().split())
x2,y2=map(int,raw_input().split())
x3,y3=map(int,raw_input().split())

for i in xrange(y2):
 a0=y1*i+x1
 if a0==0:
  continue
 if (a0-x2)%y2==0:
  for j in xrange(y3):
   res=a0+j*lcm(y1,y2)
   if (res-x3)%y3==0:
    print res
    sys.exit()
 
print -1
0