結果

問題 No.1325 Subsequence Score
ユーザー simansiman
提出日時 2023-08-02 13:58:21
言語 Ruby
(3.3.0)
結果
AC  
実行時間 354 ms / 2,000 ms
コード長 212 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 48,256 KB
最終ジャッジ日時 2024-04-20 14:02:00
合計ジャッジ時間 7,655 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
12,288 KB
testcase_01 AC 96 ms
12,160 KB
testcase_02 AC 95 ms
12,160 KB
testcase_03 AC 94 ms
12,288 KB
testcase_04 AC 96 ms
12,160 KB
testcase_05 AC 96 ms
12,032 KB
testcase_06 AC 93 ms
12,288 KB
testcase_07 AC 93 ms
12,288 KB
testcase_08 AC 99 ms
12,160 KB
testcase_09 AC 96 ms
12,288 KB
testcase_10 AC 95 ms
12,032 KB
testcase_11 AC 94 ms
12,160 KB
testcase_12 AC 92 ms
12,160 KB
testcase_13 AC 350 ms
47,616 KB
testcase_14 AC 167 ms
22,144 KB
testcase_15 AC 313 ms
42,496 KB
testcase_16 AC 338 ms
45,952 KB
testcase_17 AC 205 ms
26,368 KB
testcase_18 AC 161 ms
20,224 KB
testcase_19 AC 354 ms
48,128 KB
testcase_20 AC 134 ms
16,768 KB
testcase_21 AC 183 ms
23,936 KB
testcase_22 AC 206 ms
26,752 KB
testcase_23 AC 354 ms
48,128 KB
testcase_24 AC 352 ms
48,256 KB
testcase_25 AC 351 ms
48,000 KB
testcase_26 AC 350 ms
48,128 KB
testcase_27 AC 353 ms
48,000 KB
testcase_28 AC 93 ms
12,288 KB
testcase_29 AC 100 ms
12,288 KB
testcase_30 AC 98 ms
12,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

MOD = 998_244_353
N = gets.to_i
A = gets.split.map(&:to_i)

if N == 1
  puts A.first % MOD
  exit
end

ans = 0

1.upto(N) do |i|
  ans += (i + 1) * A[i - 1]
  ans %= MOD
end

puts (2.pow(N - 2, MOD) * ans) % MOD
0