結果

問題 No.186 中華風 (Easy)
ユーザー cielciel
提出日時 2015-04-20 00:57:33
言語 Ruby
(3.3.0)
結果
AC  
実行時間 428 ms / 2,000 ms
コード長 285 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 11,544 KB
実行使用メモリ 15,336 KB
最終ジャッジ日時 2023-09-27 00:45:00
合計ジャッジ時間 6,533 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 222 ms
15,252 KB
testcase_01 AC 152 ms
15,132 KB
testcase_02 AC 144 ms
15,280 KB
testcase_03 AC 82 ms
15,228 KB
testcase_04 AC 247 ms
15,088 KB
testcase_05 AC 239 ms
14,988 KB
testcase_06 AC 298 ms
15,228 KB
testcase_07 AC 278 ms
15,124 KB
testcase_08 AC 364 ms
15,252 KB
testcase_09 AC 352 ms
15,180 KB
testcase_10 AC 290 ms
15,336 KB
testcase_11 AC 428 ms
15,244 KB
testcase_12 AC 170 ms
14,988 KB
testcase_13 AC 175 ms
15,128 KB
testcase_14 AC 207 ms
15,088 KB
testcase_15 AC 91 ms
15,328 KB
testcase_16 AC 197 ms
15,120 KB
testcase_17 AC 159 ms
15,208 KB
testcase_18 AC 114 ms
14,984 KB
testcase_19 AC 276 ms
15,264 KB
testcase_20 AC 141 ms
15,224 KB
testcase_21 AC 249 ms
15,268 KB
testcase_22 AC 264 ms
15,024 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:13: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

#!/usr/bin/ruby
a=3.times.map{gets.split.map(&:to_i)}
f=(0..a[1][1]).find{|i|i*a[0][1]+a[0][0]>0 && (i*a[0][1]+a[0][0])%a[1][1]==a[1][0]}
if f
	x=f*a[0][1]+a[0][0]
	y=a[0][1].lcm(a[1][1])
	g=(0..a[2][1]).find{|i|x+y*i>0 && (x+y*i)%a[2][1]==a[2][0]}
	if g
		p x+y*g
		exit
	end
end
p -1
0