結果
問題 |
No.1181 Product Sum for All Subsets
|
ユーザー |
|
提出日時 | 2025-06-05 23:11:09 |
言語 | C# (.NET 8.0.404) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,040 bytes |
コンパイル時間 | 9,433 ms |
コンパイル使用メモリ | 171,488 KB |
実行使用メモリ | 187,400 KB |
最終ジャッジ日時 | 2025-06-05 23:11:26 |
合計ジャッジ時間 | 13,405 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 WA * 16 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (120 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (n, k) = (c[0], c[1]); var mod = 1_000_000_007; var half = 500000004; var mul1 = (k % mod * k % mod + 3 * k % mod) * half % mod; var mul2 = (k % mod * k % mod + k % mod) * half % mod; WriteLine((Exp(mul1, n, mod) - Exp(mul2, n, mod) + mod) % mod); } static long Exp(long n, long p, int mod) { long _n = n % mod; var _p = p; var result = 1L; if ((_p & 1) == 1) result *= _n; while (_p > 0) { _n = _n * _n % mod; _p >>= 1; if ((_p & 1) == 1) result = result * _n % mod; } return result; } }