結果

問題 No.186 中華風 (Easy)
ユーザー cielciel
提出日時 2015-04-20 01:07:41
言語 Ruby
(3.3.0)
結果
AC  
実行時間 394 ms / 2,000 ms
コード長 167 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 11,388 KB
実行使用メモリ 15,308 KB
最終ジャッジ日時 2023-09-27 00:44:53
合計ジャッジ時間 5,985 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 218 ms
15,244 KB
testcase_01 AC 138 ms
15,128 KB
testcase_02 AC 140 ms
15,128 KB
testcase_03 AC 80 ms
15,268 KB
testcase_04 AC 221 ms
15,036 KB
testcase_05 AC 207 ms
15,120 KB
testcase_06 AC 278 ms
15,236 KB
testcase_07 AC 236 ms
15,308 KB
testcase_08 AC 332 ms
15,244 KB
testcase_09 AC 320 ms
15,124 KB
testcase_10 AC 269 ms
15,136 KB
testcase_11 AC 394 ms
15,252 KB
testcase_12 AC 156 ms
15,244 KB
testcase_13 AC 177 ms
15,272 KB
testcase_14 AC 185 ms
15,092 KB
testcase_15 AC 91 ms
15,088 KB
testcase_16 AC 185 ms
15,080 KB
testcase_17 AC 144 ms
15,084 KB
testcase_18 AC 112 ms
15,116 KB
testcase_19 AC 235 ms
15,148 KB
testcase_20 AC 124 ms
15,128 KB
testcase_21 AC 224 ms
15,112 KB
testcase_22 AC 230 ms
15,176 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