結果

問題 No.149 碁石の移動
ユーザー syokeininsyokeinin
提出日時 2015-02-12 23:40:50
言語 Ruby
(3.3.0)
結果
AC  
実行時間 150 ms / 2,000 ms
コード長 277 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 11,512 KB
実行使用メモリ 15,332 KB
最終ジャッジ日時 2023-08-25 17:20:42
合計ジャッジ時間 2,873 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
15,116 KB
testcase_01 AC 73 ms
15,216 KB
testcase_02 AC 71 ms
15,264 KB
testcase_03 AC 70 ms
15,140 KB
testcase_04 AC 72 ms
15,240 KB
testcase_05 AC 94 ms
15,244 KB
testcase_06 AC 94 ms
15,224 KB
testcase_07 AC 71 ms
15,156 KB
testcase_08 AC 77 ms
15,080 KB
testcase_09 AC 79 ms
15,136 KB
testcase_10 AC 89 ms
15,292 KB
testcase_11 AC 92 ms
15,292 KB
testcase_12 AC 81 ms
15,256 KB
testcase_13 AC 77 ms
15,332 KB
testcase_14 AC 81 ms
15,052 KB
testcase_15 AC 126 ms
15,288 KB
testcase_16 AC 150 ms
15,236 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

A = gets.split.map(&:to_i)
B = gets.split.map(&:to_i)
nums = gets.split.map(&:to_i)
#A→B
nums[0].times{
  if !A[1].zero?
    A[1] -= 1
    B[1] += 1
  else
    A[0] -= 1
    B[0] += 1
  end
}
#B→A
nums[1].times{
  if !B[0].zero?
    B[0] -= 1
    A[0] += 1
  end
}

p A[0]
0