結果

問題 No.186 中華風 (Easy)
ユーザー cielciel
提出日時 2015-05-28 14:12:41
言語 Ruby
(3.2.2)
結果
AC  
実行時間 383 ms / 2,000 ms
コード長 166 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 11,292 KB
実行使用メモリ 15,320 KB
最終ジャッジ日時 2023-09-27 00:47:35
合計ジャッジ時間 6,708 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 213 ms
15,164 KB
testcase_01 AC 136 ms
15,112 KB
testcase_02 AC 139 ms
15,224 KB
testcase_03 AC 76 ms
15,228 KB
testcase_04 AC 217 ms
15,272 KB
testcase_05 AC 202 ms
15,216 KB
testcase_06 AC 280 ms
15,236 KB
testcase_07 AC 239 ms
15,192 KB
testcase_08 AC 325 ms
15,116 KB
testcase_09 AC 318 ms
15,080 KB
testcase_10 AC 275 ms
15,256 KB
testcase_11 AC 383 ms
15,144 KB
testcase_12 AC 152 ms
15,144 KB
testcase_13 AC 174 ms
15,212 KB
testcase_14 AC 192 ms
15,092 KB
testcase_15 AC 90 ms
15,320 KB
testcase_16 AC 179 ms
15,012 KB
testcase_17 AC 142 ms
15,256 KB
testcase_18 AC 111 ms
15,144 KB
testcase_19 AC 234 ms
15,016 KB
testcase_20 AC 126 ms
15,256 KB
testcase_21 AC 213 ms
15,176 KB
testcase_22 AC 227 ms
15,224 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

a=$<.map{|e|e.split.map &:to_i}
x,y=a[0]
p (1..2).each{|j|
f=(0..a[j][1]).find{|i|x+y*i>0&&(x+y*i)%a[j][1]==a[j][0]}
break if !f
x=x+y*f
y=a[j-1][1].lcm a[j][1]}?x:-1
0