結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
35,108 KB
testcase_01 AC 62 ms
38,456 KB
testcase_02 WA -
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 を復元しました (104 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  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)
    {
        var w = 0L;
        var c = 0;
        for (int i = 0; i < n - 3; i++)
        {
            w += (long)BigInteger.ModPow(10, a[i], p);
            w %= q;
            for (int j = i + 1; j < n - 2; j++)
            {
                w += (long)BigInteger.ModPow(9, a[j], p);
                w %= q;
                for (int k = j + 1; k < n - 1; k++)
                {
                    w += (long)BigInteger.ModPow(7, a[k], p);
                    w %= q;
                    for (int L = k + 1; L < n; L++)
                    {
                        w += (long)BigInteger.ModPow(5, a[L], p);
                        w %= q;
                        if (w == 0) c++;
                    }
                }
            }
        }
        Console.WriteLine(c);
    }
}
0