結果

問題 No.1915 Addition
ユーザー TKG1TKG1
提出日時 2022-04-29 22:24:43
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 335 bytes
コンパイル時間 460 ms
コンパイル使用メモリ 11,300 KB
実行使用メモリ 15,400 KB
最終ジャッジ日時 2023-09-11 13:45:31
合計ジャッジ時間 4,281 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,284 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

t = gets.to_i
t.times do
  c = gets.to_i
  cs = c.to_s
  k = cs.size
  i = ('1' * k).to_i
  j = i

  while true
    if i.to_s.size > k
      k += 1
      i = ('1' * k).to_i
      j = i
      p i, j
    end
    x = 1
    x = i - c if i > c
    if (cs + x.to_s).to_i % (c + x) == 0
      puts x
      break
    end
    i += j
  end
end

0