結果
問題 |
No.2709 1975 Powers
|
ユーザー |
![]() |
提出日時 | 2024-03-31 15:27:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,215 bytes |
コンパイル時間 | 1,864 ms |
コンパイル使用メモリ | 173,092 KB |
実行使用メモリ | 13,640 KB |
最終ジャッジ日時 | 2024-09-30 20:43:00 |
合計ジャッジ時間 | 5,123 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | TLE * 1 -- * 24 |
ソースコード
/* */ #include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for(int i = 0; i < (int)(n); i++) int main(){ int n; ll p, q; cin >> n >> p >> q; vector<int> A(n); rep(i, n){ cin >> A[i]; } sort(A.begin(), A.end()); vector<int> a(4); int ans = 0; rep(i, n){ //200 // cout << "i: " << i << endl; rep(j, n-4){ ll x = 0; // cout << "j: " << j << endl; int add = 0; if(i == 0){ add = j+1; }else{ add = j; } int cnt = 0; while(cnt < 4){ if(add != i){ a[cnt] = A[add]; cnt++; // cout << add << ' '; } add++; } ll t = 1; rep(j_, a[0]) t *= 10; x += t; t = 1; rep(j_, a[1]) t*= 9; x += t; t = 1; rep(j_, a[2]) t*= 7; x += t; t = 1; rep(j_, a[3]) t*= 5; x += t; // cout << x << endl; if(x % p == q){ // rep(i, 4){ // cout << a[i] << ' '; // }a // cout << endl; // cout << "x: " << x << endl; ans++; } // cout << endl; } } cout << ans << endl; return 0; }