Lmm_a @ 2021-07-29 00:35:33
#include<bits/stdc++.h>
using namespace std;
int m[8]={1,10,100,1000,10000,100000,1000000,10000000};
int a[1050];
int main(){
int n,q,l,r,c=-1,k,sum=0;
cin>>n>>q;
for(int i=1;i<=n;i++){
cin>>a[i];
}
sort(a+1,a+n+1);
while(q--){
c=-1;
cin>>l>>r;
for(int i=1;i<=n;i++){
k=a[i]%m[l];
if(k==r){
c=a[i];
break;
}
}
cout<<c<<endl;
}
}
by Chancylaser @ 2021-07-29 00:42:15
哪里对不上啦?