結果
| 問題 | No.2709 1975 Powers | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-04-02 13:28:39 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                RE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 905 bytes | 
| コンパイル時間 | 4,462 ms | 
| コンパイル使用メモリ | 253,040 KB | 
| 最終ジャッジ日時 | 2025-02-20 19:38:10 | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | RE * 25 | 
コンパイルメッセージ
main.cpp:9:4: warning: built-in function ‘pow10’ declared as non-function [-Wbuiltin-declaration-mismatch]
    9 | ll pow10[202020], pow9[202020], pow7[202020], pow5[202020], ans;
      |    ^~~~~
            
            ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;
int N, P, Q, A[202];
ll pow10[202020], pow9[202020], pow7[202020], pow5[202020], ans;
int main() {
  cin >> N >> P >> Q;
  for (int i = 0; i < N; i++) cin >> A[i];
  sort(A, A + N);
  pow10[0] = pow9[0] = pow7[0] = pow5[0] = 1;
  for (int i = 1; i <= 200000; i++) {
    pow10[i] = (pow10[i - 1] * 10) % P;
    pow9[i] = (pow9[i - 1] * 9) % P;
    pow7[i] = (pow7[i - 1] * 7) % P;
    pow5[i] = (pow5[i - 1] * 5) % P;
  }
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      for (int k = j + 1; k < N; k++) {
        for (int l = k + 1; l < N; l++) {
          int a = A[i], b = A[j], c = A[k], d = A[l];
          if ((pow10[a] + pow9[b] + pow7[c] + pow5[d]) % P == Q) ans++;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
            
            
            
        