結果
問題 | No.2260 Adic Sum |
ユーザー |
|
提出日時 | 2023-03-15 00:32:32 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 996 ms / 2,000 ms |
コード長 | 372 bytes |
コンパイル時間 | 1,980 ms |
コンパイル使用メモリ | 200,272 KB |
最終ジャッジ日時 | 2025-02-11 11:29:00 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;int main() {ll N,P;cin>>N>>P;vector<int> A(N);for(int i=0;i<N;i++)cin>>A[i];ll an=0;ll p=P;while(p<1e9+3){map<ll,ll> M;for(int i=0;i<N;i++){an+=M[A[i]%p];M[A[i]%p]++;}p*=P;}cout<<an<<endl;}