wyjzsx1314 @ 2017-12-02 18:29:51
代码:
#include<cstdio>
#include<iostream>
using namespace std;
int n,p,a[1003],b[1003],c[10],d[1003],m=1,hhh=10000005,q=0;
int main(){
cin>>n>>p;
for(int i=1;i<=n;i++)
cin>>a[i];
for(int i=1;i<=p;i++)
cin>>c[i]>>b[i];
for(int i=1;i<=p;i++){
while(c[i]>0){
m=m*10;
c[i]--;
}
for(int j=1;j<=n;j++){
d[j]=a[j];
d[j]=d[j]%m;
if(d[j]==b[i]&&a[j]<hhh){
hhh=a[j];
q++;
}
}
m=1;
if(q==0)cout<<"-1"<<endl;
else {cout<<hhh<<endl;
hhh=10000005;
q=0;
}
}
return 0;
}
by 李柯欣 @ 2022-02-02 21:48:07
...
我也布吉岛啊