wxr0108 @ 2022-10-02 11:13:11
#include<bits/stdc++.h>
using namespace std;
int a[114514],b[114514],x[114514];
int kk(int t){
int ans=1;
for(int i=1;i<=t;i++) ans*=10;
return ans;
}
int main(){
int n,q;
cin>>n>>q;
for(int i=1;i<=n;i++) cin>>a[i];
for(int i=1;i<=q;i++){
//int x;
cin>>x[i]>>b[i];
}
long long mmin=1000000;
for(int i=1;i<=q;i++){
long long mmin=1000000;
for(int j=1;j<=n;j++){
int t=x[i];//先求出摸多少位
if((a[j]%kk(t))==b[i]&&a[j]<mmin){//如果符合条件且是当前最小值
mmin=a[j];
}
}
if(mmin!=1000000) cout<<mmin<<endl;
else cout<<"-1\n";
}
return 0;
}
by Failure_Terminator @ 2022-10-02 11:38:00
有点臭,不想改
by _Timeless_ @ 2022-10-04 21:17:47
同意楼上
by wxr0108 @ 2022-10-05 08:36:26
@zhuang1126 你还是蓝名呢,闭嘴吧你,刘德华改名刘华——