NinjaSword @ 2019-11-08 17:20:16
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include <algorithm>
using namespace std;
int n,q,i,j,c,a[1010],b[1010],d[1010]zxz,tmp;
main()
{
cin>>n>>q;
for(i=1;i<=n;i++)
cin>>a[i];
for(i=1;i<=q;i++)
{
cin>>b[i];
cin>>d[i];
}
for(i=1;i<=q;i++)
{
zxz=9999;
tmp=pow(10,b[i]);
for(j=1;j<=n;j++)
if(a[j]%tmp==d[i]&&zxz>a[j]) zxz=a[j];
if(zxz!=9999) cout<<zxz<<endl;
else cout<<"-1"<<endl;
}
return 0;
}
请问各位大佬为什么这个代码本地卡不出数,洛谷CE? 求助!!
by 梧桐灯 @ 2019-11-08 17:21:48
d[1010]zxz
有问题
by NinjaSword @ 2019-11-08 17:23:11
好得,谢谢!@梧桐灯