Submission #71170676
Source Code Expand
#include<bits/stdc++.h>
const int N = 1e6 + 10;
using namespace std;
map<int,int>mp[15];
int Get_digit(int x){
if(x<=9)return 1;
return Get_digit(x/10)+1;
}
int A[M];
int main(){
int n,m;
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)scanf("%d",&A[i]);
long long ans=0;
for(int i=1;i<=n;i++)mp[Get_digit(A[i])][A[i]%m]++;
for(int i=1;i<=n;i++){
int x=A[i];
int d=x%m;
for(int j=1;j<=10;j++){
d=10ll*d%m;
ans+=mp[j][(m-d)%m];
}
}
printf("%lld\n",ans);
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - 183183 |
| User | Hacker_ |
| Language | C++23 (GCC 15.2.0) |
| Score | 0 |
| Code Size | 512 Byte |
| Status | CE |
Compile Error
./Main.cpp:9:7: error: 'M' was not declared in this scope
9 | int A[M];
| ^
./Main.cpp: In function 'int main()':
./Main.cpp:13:42: error: 'A' was not declared in this scope
13 | for(int i=1;i<=n;i++)scanf("%d",&A[i]);
| ^
./Main.cpp:15:43: error: 'A' was not declared in this scope
15 | for(int i=1;i<=n;i++)mp[Get_digit(A[i])][A[i]%m]++;
| ^
./Main.cpp:17:23: error: 'A' was not declared in this scope
17 | int x=A[i];
| ^