uva 10152 ShellSort(模拟)

来源:互联网 发布:图片锐化软件 编辑:程序博客网 时间:2024/05/18 10:35

代码:

#include <cstdio>#include <iostream>#include <string>using namespace std;const int maxn = 1000 + 1;int n;string a[maxn], b[maxn];int main(){    #ifdef LOCAL    freopen("in.txt", "r", stdin);    #endif // LOCAL    int ncase;    cin >> ncase;    int i, j;    while (ncase--)    {        cin >> n;        getchar();        for (i = 0; i < n; i++)            getline(cin, a[i]);        for (i = 0; i < n; i++)            getline(cin, b[i]);        for (i = n - 1, j = n - 1; i >= 0; i--)            if(a[i] == b[j])                j--;        for (;j >= 0; j--)            cout << b[j] << endl;        cout << endl;    }    return 0;}


0 0