HDU ACM 11 2034 人见人恨的A-B(此题题目有问题,不要纠结代码为何可以AC)

来源:互联网 发布:aster数据 编辑:程序博客网 时间:2024/05/01 19:08
#include <iostream>using namespace std;int main(){int m, n, y;int Lu[200], Yi[200], Zheng[200], Hui[200];while (cin >> m >> n){if (m == 0 && n == 0)break;memset(Zheng, 0, sizeof(Zheng));y = 0;for (int i = 0; i < m; i++)cin >> Lu[i];for (int i = 0; i < n; i++)cin >> Yi[i];for (int i = 0; i < m; i++)for (int x = 0; x < n; x++)if (Lu[i] == Yi[x])Zheng[i] = 1;for (int i = 0; i < m; i++)if (Zheng[i] == 0)Hui[y++] = Lu[i];for (int i = 0; i < y; i++)for (int x = i; x < y; x++)if (Hui[i] > Hui[x])swap(Hui[i], Hui[x]);if (y == 0)cout << "NULL";elsefor (int i = 0; i < y; i++)cout << Hui[i] << ' ';cout << endl;}return 0;}

0 0
原创粉丝点击