結果
| 問題 |
No.2709 1975 Powers
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-31 13:51:52 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,313 bytes |
| コンパイル時間 | 2,085 ms |
| コンパイル使用メモリ | 199,424 KB |
| 最終ジャッジ日時 | 2025-02-20 16:38:41 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 1 TLE * 1 -- * 23 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
template<class T> using graph=vector<vector<T>>;
template<class T> using min_priority_queue=priority_queue<T,vector<T>,greater<T>>;
constexpr int INF32=INT_MAX/2;
constexpr ll INF64=1LL<<60;
constexpr array<int,4> DX4={0,1,0,-1};
constexpr array<int,4> DY4={-1,0,1,0};
constexpr array<int,8> DX8={0,1,1,1,0,-1,-1,-1};
constexpr array<int,8> DY8={-1,-1,0,1,1,1,0,-1};
inline int popcnt(ll n){return __builtin_popcountll(n);}
template<class T> inline bool chmax(T& a,const T& b){return a<b?a=b,true:false;}
template<class T> inline bool chmin(T& a,const T& b){return b<a?a=b,true:false;}
#define rep(i,s,n) for(ll i=(ll)(s);i<(ll)(n);i++)
#define rrep(i,s,n) for(ll i=(ll)(s);i>=(ll)(n);i--)
void _main();
int main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout<<fixed<<setprecision(16);
_main();
}
#include <atcoder/modint>
using atcoder::modint;
void _main(){
int N, P, Q; cin >> N >> P >> Q;
vector<ll> A(N); rep(i,0,N) cin >> A[i];
modint::set_mod(P);
int ans = 0;
rep(i,0,N) rep(j,i+1,N) rep(k,j+1,N) rep(l,k+1,N){
ll a = A[i], b = A[j], c = A[k], d = A[l];
if(modint(10).pow(a) + modint(9).pow(b) + modint(7).pow(c) + modint(5).pow(d) == modint(Q)){
ans++;
}
}
cout << ans << endl;
}