結果

問題 No.2709 1975 Powers
ユーザー rikeichan
提出日時 2024-03-31 17:38:48
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 536 bytes
コンパイル時間 1,778 ms
コンパイル使用メモリ 170,988 KB
実行使用メモリ 13,632 KB
最終ジャッジ日時 2024-09-30 21:11:59
合計ジャッジ時間 7,032 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 1 TLE * 2 -- * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(){
    int N, P, Q;
    cin >> N >> P >> Q;
    double A[N];
    for (int i=0; i<N; ++i){
        cin >> A[i];
    }

    sort(A, A+N);
    int ans=0;
    for (int i=0; i<N-3; ++i){
        for (int j=i+1; j<N-2; ++j){
            for (int k=j+1; k<N-1; ++k){
                for (int l=k+1; l<N; ++l){
                    if ((long long)(pow(10.0,A[i])+pow(9.0,A[j])+pow(7.0, A[k])+pow(5.0, A[l]))%P==Q){ans++;}
                }
            }
        }
    }
    cout << ans;
}
0