結果

問題 No.187 中華風 (Hard)
ユーザー cielciel
提出日時 2015-04-20 17:28:15
言語 Ruby
(3.3.0)
結果
AC  
実行時間 220 ms / 3,000 ms
コード長 210 bytes
コンパイル時間 67 ms
コンパイル使用メモリ 11,476 KB
実行使用メモリ 26,292 KB
最終ジャッジ日時 2023-08-26 23:16:53
合計ジャッジ時間 4,986 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
15,088 KB
testcase_01 AC 90 ms
15,156 KB
testcase_02 AC 123 ms
20,048 KB
testcase_03 AC 116 ms
20,108 KB
testcase_04 AC 214 ms
26,004 KB
testcase_05 AC 206 ms
25,864 KB
testcase_06 AC 204 ms
25,932 KB
testcase_07 AC 206 ms
25,564 KB
testcase_08 AC 215 ms
26,292 KB
testcase_09 AC 220 ms
26,228 KB
testcase_10 AC 211 ms
25,876 KB
testcase_11 AC 206 ms
26,000 KB
testcase_12 AC 206 ms
25,860 KB
testcase_13 AC 85 ms
15,036 KB
testcase_14 AC 84 ms
15,252 KB
testcase_15 AC 105 ms
18,680 KB
testcase_16 AC 105 ms
18,644 KB
testcase_17 AC 82 ms
15,220 KB
testcase_18 AC 84 ms
15,128 KB
testcase_19 AC 80 ms
15,172 KB
testcase_20 AC 173 ms
23,732 KB
testcase_21 AC 82 ms
15,088 KB
testcase_22 AC 205 ms
25,492 KB
testcase_23 AC 82 ms
15,268 KB
testcase_24 AC 82 ms
15,260 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:6: warning: assigned but unused variable - y
Syntax OK

ソースコード

diff #

f=->x,y{return[x,1,0]if y==0
g,a,b=f[y,x%y]
[g,b,a-x/y*b]}
gets
a=$<.map{|e|e.split.map &:to_i}
p (r=a.reduce{|(a,m),(b,n)|g,x,y=f[m,n]
break if(b-=a)%g>0
n*=m/g
[(a+b/g*x*m)%n,n]})?r[~(0<=>r[0])]%1000000007:-1
0