結果

問題 No.782 マイナス進数
ユーザー simansiman
提出日時 2023-03-09 13:10:00
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 217 bytes
コンパイル時間 420 ms
コンパイル使用メモリ 11,940 KB
実行使用メモリ 16,192 KB
最終ジャッジ日時 2023-10-18 06:16:10
合計ジャッジ時間 7,715 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
16,080 KB
testcase_01 AC 87 ms
16,080 KB
testcase_02 AC 118 ms
16,192 KB
testcase_03 AC 123 ms
16,188 KB
testcase_04 AC 130 ms
16,188 KB
testcase_05 AC 120 ms
16,188 KB
testcase_06 AC 115 ms
16,188 KB
testcase_07 AC 144 ms
16,188 KB
testcase_08 AC 121 ms
16,188 KB
testcase_09 AC 117 ms
16,188 KB
testcase_10 AC 118 ms
16,188 KB
testcase_11 AC 144 ms
16,188 KB
testcase_12 AC 137 ms
16,188 KB
testcase_13 AC 206 ms
16,188 KB
testcase_14 AC 138 ms
16,188 KB
testcase_15 AC 144 ms
16,188 KB
testcase_16 AC 137 ms
16,188 KB
testcase_17 AC 172 ms
16,188 KB
testcase_18 AC 138 ms
16,184 KB
testcase_19 AC 159 ms
16,188 KB
testcase_20 AC 138 ms
16,188 KB
testcase_21 AC 167 ms
16,188 KB
testcase_22 AC 142 ms
16,188 KB
testcase_23 AC 132 ms
16,188 KB
testcase_24 AC 204 ms
16,188 KB
testcase_25 AC 137 ms
16,188 KB
testcase_26 AC 152 ms
16,188 KB
testcase_27 AC 143 ms
16,188 KB
testcase_28 AC 135 ms
16,188 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:9: warning: assigned but unused variable - x
Syntax OK

ソースコード

diff #

T, B = gets.split.map(&:to_i)

T.times do
  n = gets.to_i

  ans = ''

  while n != 0
    x = n
    n, m = n.divmod(B)

    if m != 0
      n += 1
      m -= B
    end

    ans << m.to_s
  end

  puts ans.reverse
end
0