結果
| 問題 |
No.2709 1975 Powers
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-31 13:51:56 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,505 bytes |
| コンパイル時間 | 3,032 ms |
| コンパイル使用メモリ | 250,588 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-09-30 18:31:32 |
| 合計ジャッジ時間 | 11,015 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 WA * 16 |
ソースコード
#ifndef akinyan
#define akinyan
#include <bits/stdc++.h>
using namespace std;
using ch = char;
using ll = long long;
using ld = long double;
using db = double;
using st = string;
using vdb = vector<db>;
using vvdb = vector<vdb>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<ld>;
using vvd = vector<vd>;
using vs = vector<st>;
using vvs = vector<vs>;
using vc = vector<ch>;
using vvc = vector<vc>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
const ll mod = 998244353;
const ll MOD = 1000000007;
const ll INF = 1000000000000000000LL;
using pall = pair<ll,ll>;
using vp = vector<pall>;
#endif
ll modpow(ll a, ll n, ll m) {
ll res = 1;
while (n > 0) {
if (n & 1) res = res * a % m;
a = a * a % m;
n >>= 1;
}
return res;
}
int main(){
ll N,P,Q;
cin>>N>>P>>Q;
vl A(N);
for(int i=0; i<N; i++){
cin>>A[i];
}
vvl X(N,vl(4));
for(int i=0; i<N; i++){
X[i][0] = modpow(10,A[i],P);
X[i][1] = modpow(9,A[i],P);
X[i][2] = modpow(7,A[i],P);
X[i][3] = modpow(5,A[i],P);
}
ll 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++){
for(int d=c+1; d<N; d++){
if((X[a][0] + X[b][1] + X[c][2] + X[d][3]) % P == Q){
ans++;
}
}
}
}
}
cout << ans << endl;
}