結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 221 ms
15,128 KB
testcase_01 AC 140 ms
15,124 KB
testcase_02 AC 139 ms
15,272 KB
testcase_03 AC 82 ms
15,080 KB
testcase_04 AC 222 ms
15,220 KB
testcase_05 AC 211 ms
15,304 KB
testcase_06 AC 283 ms
15,120 KB
testcase_07 AC 238 ms
15,332 KB
testcase_08 AC 335 ms
15,300 KB
testcase_09 AC 324 ms
15,280 KB
testcase_10 AC 274 ms
15,208 KB
testcase_11 AC 390 ms
15,308 KB
testcase_12 AC 154 ms
15,184 KB
testcase_13 AC 172 ms
15,128 KB
testcase_14 AC 188 ms
15,328 KB
testcase_15 AC 92 ms
15,104 KB
testcase_16 AC 182 ms
15,016 KB
testcase_17 AC 142 ms
15,168 KB
testcase_18 AC 114 ms
15,128 KB
testcase_19 AC 230 ms
15,080 KB
testcase_20 AC 127 ms
15,128 KB
testcase_21 AC 204 ms
15,296 KB
testcase_22 AC 235 ms
15,224 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

a=(1..3).map{gets.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