《算法筆記》3.2小節 1937 Problem D 查找
阿新 • • 發佈:2018-12-06
pan clu lse clas problem code ++ spa \n
#include <stdio.h> const int maxn = 100; int a[maxn] = {0}; int b[maxn]= {0}; int main(void) { int n; while(scanf("%d", &n) != EOF){ for(int i=0; i<n; i++){ scanf("%d", a+i); } int m; scanf("%d", &m); int j; for(int i=0; i<m; i++){ scanf("%d", b+i); for(j=0; j<n; j++){ if(a[j] == b[i]) break; } if (j==n) printf("NO\n"); else printf("YES\n"); } } }
《算法筆記》3.2小節 1937 Problem D 查找