結果
| 問題 |
No.2709 1975 Powers
|
| コンテスト | |
| ユーザー |
nonon
|
| 提出日時 | 2024-03-31 14:09:34 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 549 ms / 2,000 ms |
| コード長 | 620 bytes |
| コンパイル時間 | 2,008 ms |
| コンパイル使用メモリ | 199,812 KB |
| 最終ジャッジ日時 | 2025-02-20 16:59:19 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/math>
using namespace std;
int N,P,Q,A[200];
int p10[1<<17];
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);
long ans=0;
for(int a=0;a<N;a++)
{
for(int b=a+1;b<N;b++)for(int c=b+1;c<N;c++)
{
long p9=atcoder::pow_mod(9,A[a],P);
long p7=atcoder::pow_mod(7,A[b],P);
long p5=atcoder::pow_mod(5,A[c],P);
ans+=p10[((Q-p9-p7-p5)%P+P)%P];
}
p10[atcoder::pow_mod(10,A[a],P)]++;
}
cout<<ans<<endl;
}
nonon