結果
問題 |
No.1325 Subsequence Score
|
ユーザー |
|
提出日時 | 2020-12-25 22:29:49 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 554 bytes |
コンパイル時間 | 1,096 ms |
コンパイル使用メモリ | 112,032 KB |
実行使用メモリ | 70,528 KB |
最終ジャッジ日時 | 2024-09-22 15:52:17 |
合計ジャッジ時間 | 6,881 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 1 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Linq; class V { static long[] ReadL() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse); static void Main() { var n = int.Parse(Console.ReadLine()); var a = ReadL(); if (n == 1) { Console.WriteLine(a[0]); } else { var s = a.Select((x, i) => (i + 2) * x % M).Sum() % M; Console.WriteLine(s * MPow(2, n - 2) % M); } } const long M = 998244353; static long MPow(long b, long i) { long r = 1; for (; i != 0; b = b * b % M, i >>= 1) if ((i & 1) != 0) r = r * b % M; return r; } }