結果

問題 No.1824 門\松\列
ユーザー simansiman
提出日時 2022-01-29 04:00:10
言語 Ruby
(3.3.0)
結果
AC  
実行時間 218 ms / 2,000 ms
コード長 170 bytes
コンパイル時間 472 ms
コンパイル使用メモリ 11,316 KB
実行使用メモリ 23,796 KB
最終ジャッジ日時 2023-08-29 23:36:43
合計ジャッジ時間 3,082 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 195 ms
23,044 KB
testcase_01 AC 196 ms
22,936 KB
testcase_02 AC 202 ms
23,100 KB
testcase_03 AC 218 ms
23,796 KB
testcase_04 AC 210 ms
23,148 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

T = gets.to_i

memo = Array.new(1_000_010, 0)
3.upto(1_000_010) do |n|
  memo[n] = memo[n - 1] + (n - 1) * (n - 2)
end

T.times do
  n = gets.to_i
  puts 2 * memo[n]
end
0