結果

問題 No.1915 Addition
ユーザー TKG1TKG1
提出日時 2022-04-29 22:12:17
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 314 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 11,352 KB
実行使用メモリ 20,140 KB
最終ジャッジ日時 2023-09-11 13:27:40
合計ジャッジ時間 5,021 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

t = gets.to_i
t.times do
  c = gets.to_i
  cs = c.to_s
  i = 11
  j = 11

  while true
    if i % 9 == 0
      i = i.to_s + '9'
      j = ('1' * i.size).to_i
      i = i.to_i/9
    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