結果

問題 No.2709 1975 Powers
ユーザー bluemeganebluemegane
提出日時 2024-04-04 09:49:19
言語 C#
(.NET 8.0.203)
結果
TLE  
実行時間 -
コード長 1,276 bytes
コンパイル時間 7,711 ms
コンパイル使用メモリ 157,056 KB
実行使用メモリ 39,864 KB
最終ジャッジ日時 2024-04-04 09:49:31
合計ジャッジ時間 11,287 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
35,364 KB
testcase_01 AC 71 ms
38,712 KB
testcase_02 AC 242 ms
32,164 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (111 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
/home/judge/data/code/Main.cs(19,13): warning CS0219: 変数 'w' は割り当てられていますが、その値は使用されていません [/home/judge/data/code/main.csproj]
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

using System.Numerics;
using System;

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var p = int.Parse(line[1]);
        var q = int.Parse(line[2]);
        line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        getAns(n, p, q, a);
    }
    static void getAns(int n, int p, int q, int[] a)
    {
        Array.Sort(a);
        var w = 0L;
        var c = 0;
        for (int i = 0; i < n - 3; i++)
        {
            var w0 = (long)BigInteger.ModPow(10, a[i], p);
            for (int j = i + 1; j < n - 2; j++)
            {
                var w1 = w0 + (long)BigInteger.ModPow(9, a[j], p);
                w1 %= p;
                for (int k = j + 1; k < n - 1; k++)
                {
                    var w2 = w1 + (long)BigInteger.ModPow(7, a[k], p);
                    w2 %= p;
                    for (int L = k + 1; L < n; L++)
                    {
                        var w3 = w2 + (long)BigInteger.ModPow(5, a[L], p);
                        w3 %= p;
                        if (w3 == q) c++;
                    }
                }
            }
        }
        Console.WriteLine(c);
    }
}
0