参考代码:
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> int main() { int n = 0; while (1) { scanf("%d", &n); if (n == -1) { break; } else { int alreadyExit[n]; for (int i = 0; i < n; ++i) { scanf("%d", &alreadyExit[i]); } int m = 0; scanf("%d", &m); while (m--) { int newNumber = 0; scanf("%d", &newNumber); int notExit = 0; for (int i = 0; i < n; ++i) { if (alreadyExit[i] == newNumber) { printf("YES\n"); notExit = 1; break; } } if (notExit == 0) { printf("NO\n"); } } } printf("\n"); } return 0; }
0.0分
3 人评分
校门外的树 (C++代码)浏览:907 |
2006年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:618 |
C语言考试练习题_排列 (C++代码)浏览:1112 |
汽水瓶 (C++代码)(直接n/2就可以了)浏览:1138 |
剔除相关数 (C语言代码)浏览:1924 |
点我有惊喜!你懂得!浏览:1166 |
点我有惊喜!你懂得!浏览:2114 |
C语言训练-计算t=1+1/2+1/3+...+1/n (C语言代码)浏览:539 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:674 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:672 |