結果

問題 No.1926 Sequence of Remainders
ユーザー simansiman
提出日時 2022-05-15 18:48:34
言語 Ruby
(3.3.0)
結果
AC  
実行時間 362 ms / 2,000 ms
コード長 222 bytes
コンパイル時間 64 ms
コンパイル使用メモリ 11,548 KB
実行使用メモリ 15,452 KB
最終ジャッジ日時 2023-10-11 04:52:12
合計ジャッジ時間 21,704 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,232 KB
testcase_01 AC 342 ms
15,192 KB
testcase_02 AC 335 ms
15,144 KB
testcase_03 AC 334 ms
15,332 KB
testcase_04 AC 334 ms
15,260 KB
testcase_05 AC 333 ms
15,384 KB
testcase_06 AC 355 ms
15,452 KB
testcase_07 AC 357 ms
15,252 KB
testcase_08 AC 354 ms
15,248 KB
testcase_09 AC 356 ms
15,192 KB
testcase_10 AC 359 ms
15,408 KB
testcase_11 AC 362 ms
15,308 KB
testcase_12 AC 356 ms
15,344 KB
testcase_13 AC 360 ms
15,384 KB
testcase_14 AC 356 ms
15,236 KB
testcase_15 AC 354 ms
15,328 KB
testcase_16 AC 350 ms
15,280 KB
testcase_17 AC 355 ms
15,140 KB
testcase_18 AC 358 ms
15,260 KB
testcase_19 AC 357 ms
15,324 KB
testcase_20 AC 353 ms
15,244 KB
testcase_21 AC 352 ms
15,196 KB
testcase_22 AC 359 ms
15,204 KB
testcase_23 AC 356 ms
15,260 KB
testcase_24 AC 356 ms
15,344 KB
testcase_25 AC 355 ms
15,396 KB
testcase_26 AC 355 ms
15,344 KB
testcase_27 AC 358 ms
15,120 KB
testcase_28 AC 357 ms
15,204 KB
testcase_29 AC 358 ms
15,260 KB
testcase_30 AC 352 ms
15,248 KB
testcase_31 AC 355 ms
15,252 KB
testcase_32 AC 352 ms
15,232 KB
testcase_33 AC 353 ms
15,400 KB
testcase_34 AC 353 ms
15,392 KB
testcase_35 AC 356 ms
15,188 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

T = gets.to_i

T.times do
  n, m, k = gets.split.map(&:to_i)

  i = 1
  a = k % m

  while i <= n
    if a < m - i
      d = (m - i) - a
      i += d
    else
      a = a % (m - i)
      i += 1
    end
  end

  puts a
end
0