結果
問題 | No.1325 Subsequence Score |
ユーザー |
|
提出日時 | 2020-12-25 22:31:00 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 288 ms / 2,000 ms |
コード長 | 558 bytes |
コンパイル時間 | 2,205 ms |
コンパイル使用メモリ | 110,320 KB |
実行使用メモリ | 68,484 KB |
最終ジャッジ日時 | 2024-09-22 15:52:25 |
合計ジャッジ時間 | 5,965 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
コンパイルメッセージ
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] % M); } 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; } }