zhaohanyan @ 2022-10-05 17:59:26
cpp
#include<bits/stdc++.h>
using namespace std;
int n,m,a[999999],x,ma,chushu;
int main() {
cin>>n>>m;
for(int i=0;i<n;i++){
cin>>a[i];
}
sort(a,a+n);
for(int i=0;i<m;i++){
cin>>x>>ma;
for(int j=0;j<n;j++){
chushu=pow(10,x);
if(a[j]%chushu==ma){
cout<<a[j]<<endl;
goto over;
}
}
cout<<-1;
over:
continue;
}
return 0;
}
by jnyz2021109122116 @ 2022-10-05 23:15:11
@zhaohanyan -1后面没换行
(你也不试试样例
by zhaohanyan @ 2022-10-06 15:14:53
感谢
by CSP_AK_zc @ 2022-10-23 09:56:14
水数据