結果

問題 No.2709 1975 Powers
ユーザー nononnonon
提出日時 2024-03-31 15:57:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 837 ms / 2,000 ms
コード長 645 bytes
コンパイル時間 2,165 ms
コンパイル使用メモリ 204,208 KB
実行使用メモリ 68,220 KB
最終ジャッジ日時 2024-03-31 15:57:58
合計ジャッジ時間 13,518 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
68,216 KB
testcase_01 AC 94 ms
68,216 KB
testcase_02 AC 100 ms
68,220 KB
testcase_03 AC 490 ms
68,220 KB
testcase_04 AC 789 ms
68,220 KB
testcase_05 AC 544 ms
68,220 KB
testcase_06 AC 228 ms
68,220 KB
testcase_07 AC 94 ms
68,216 KB
testcase_08 AC 219 ms
68,220 KB
testcase_09 AC 525 ms
68,220 KB
testcase_10 AC 95 ms
68,216 KB
testcase_11 AC 105 ms
68,220 KB
testcase_12 AC 125 ms
68,220 KB
testcase_13 AC 569 ms
68,220 KB
testcase_14 AC 155 ms
68,220 KB
testcase_15 AC 164 ms
68,220 KB
testcase_16 AC 460 ms
68,220 KB
testcase_17 AC 96 ms
68,216 KB
testcase_18 AC 135 ms
68,220 KB
testcase_19 AC 720 ms
68,220 KB
testcase_20 AC 98 ms
68,220 KB
testcase_21 AC 232 ms
68,220 KB
testcase_22 AC 813 ms
68,220 KB
testcase_23 AC 837 ms
68,220 KB
testcase_24 AC 836 ms
68,220 KB
testcase_25 AC 812 ms
68,220 KB
testcase_26 AC 836 ms
68,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int N,P,Q,A[200];
const int M=2e6;
long p1[1<<21],p9[1<<21],p7[1<<21],p5[1<<21];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>N>>P>>Q;
    for(int i=0;i<N;i++)cin>>A[i];
    sort(A,A+N);
    p1[0]=p9[0]=p7[0]=p5[0]=1;
    for(int i=1;i<=M;i++)
    {
        p1[i]=(p1[i-1]*10)%P;
        p9[i]=(p9[i-1]*9)%P;
        p7[i]=(p7[i-1]*7)%P;
        p5[i]=(p5[i-1]*5)%P;
    }
    int ans=0;
    for(int i=0;i<N;i++)for(int j=0;j<i;j++)for(int k=0;k<j;k++)for(int l=0;l<k;l++)
    {
        if((p1[A[l]]+p9[A[k]]+p7[A[j]]+p5[A[i]])%P==Q)ans++;
    }
    cout<<ans<<'\n';
}
0