比赛 |
202110省实验桐柏一中普及组联赛 |
评测结果 |
ATATTAATAT |
题目名称 |
Killer |
最终得分 |
50 |
用户昵称 |
ming_xin |
运行时间 |
5.000 s |
代码语言 |
C++ |
内存使用 |
2.92 MiB |
提交时间 |
2021-10-18 20:13:26 |
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
int die[10005];
struct key
{
int b,num;
}s[10005];
inline unsigned long long read()
{
register unsigned long long s=0,w=1;
register char ch=getchar();
while(ch<'0'||ch>'9')
{
if(ch=='-')
{
w=-1;
ch=getchar();
}
}
while(ch>='0'&&ch<='9')
{
s=s*10+ch-'0';
ch=getchar();
}
return s*w;
}
int main(void)
{
bool pd = true;
freopen("killer.in","r",stdin);
freopen("killer.out","w",stdout);
int m,n,r,a[10005];
m = read(); n = read(); r = read();
for(int i = 1; i <= m; ++i) a[i] = read();
for(int i = 1; i <= n; ++i)
{
s[i].b = read();
s[i].num = i;
}
for(int i = 1; i <= n; ++i)
{
int ress = 0;
for(int j = 1; j <= m; ++j)
{
if(s[i].b % a[j] == 0)
{
ress++;
}
}
if(ress == m)
{
printf("%d",s[i].num);
return 0;
}
}
for(int i = 1; i <= n; ++i)
{
int res = 0;
for(int j = 1; j <= m; ++j)
{
if(s[i].b % a[j] == 0) res++;
}
if(res >= r)
{
printf("%d ",s[i].num);
pd = false;
}
}
if(pd) printf("0");
return 0;
}