zoukankan      html  css  js  c++  java
  • Codeforces Round #294 (Div. 2)——B——A and B and Compilation Errors

    A and B are preparing themselves for programming contests.

    B loves to debug his code. But before he runs the solution and starts debugging, he has to first compile the code.

    Initially, the compiler displayed n compilation errors, each of them is represented as a positive integer. After some effort, B managed to fix some mistake and then another one mistake.

    However, despite the fact that B is sure that he corrected the two errors, he can not understand exactly what compilation errors disappeared — the compiler of the language which B uses shows errors in the new order every time! B is sure that unlike many other programming languages, compilation errors for his programming language do not depend on each other, that is, if you correct one error, the set of other error does not change.

    Can you help B find out exactly what two errors he corrected?

    Input

    The first line of the input contains integer n (3 ≤ n ≤ 105) — the initial number of compilation errors.

    The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the errors the compiler displayed for the first time.

    The third line contains n - 1 space-separated integers b1, b2, ..., bn - 1 — the errors displayed at the second compilation. It is guaranteed that the sequence in the third line contains all numbers of the second string except for exactly one.

    The fourth line contains n - 2 space-separated integers с1, с2, ..., сn - 2 — the errors displayed at the third compilation. It is guaranteed that the sequence in the fourth line contains all numbers of the third line except for exactly one.

    Output

    Print two numbers on a single line: the numbers of the compilation errors that disappeared after B made the first and the second correction, respectively.

    Sample test(s)
    input
    5
    1 5 8 123 7
    123 7 5 1
    5 1 7
    output
    8
    123
    input
    6
    1 4 3 3 5 7
    3 7 5 4 3
    4 3 7 5
    output
    1
    3
    Note

    In the first test sample B first corrects the error number 8, then the error number 123.

    In the second test sample B first corrects the error number 1, then the error number 3. Note that if there are multiple errors with the same number, B can correct only one of them in one step.

    大意:错了哪个?考思维orz,果然太笨,只要上面之和减去下面之和就是所求的值

    #include<cstdio>
    using namespace std;
    const int MAX = 111111;
    long  int a[MAX],b[MAX],c[MAX];
    int main()
    {
        int n;
        long long int sum1, sum2, sum3;
        while(~scanf("%d",&n)){
                sum1 = sum2 = sum3 = 0;
                for(int i = 1; i <= n; i++){
                    scanf("%ld",&a[i]);
                    sum1 += a[i];
                }
                for(int i = 1; i < n ; i++){
                    scanf("%ld",&b[i]);
                    sum2 += b[i];
                }
                for(int i = 1; i < n - 1; i++){
                        scanf("%ld",&c[i]);
                       sum3 += c[i];
                }
                printf("%ld
    ", sum1 - sum2);
                printf("%ld
    ", sum2 - sum3);
        }
        return 0;
    }
    View Code
  • 相关阅读:
    《高效能人士的七个习惯》读书笔记
    《精进》读书摘要
    讲述测试自己的故事
    搭建项目自动化框架的搭建、改进与思考
    真是个信息爆炸的世界
    C#中的WebBrowser控件的使用
    C#动态调用webService出现 基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系。
    C#抓取网面上的html内容(JS动态生成的无法抓取)
    SQL还原数据库后,数据库显示受限制用户解决方法
    [Microsoft][ODBC 驱动程序管理器] 在指定的 DSN 中,驱动程序和应用程序之间的体系结构不匹配
  • 原文地址:https://www.cnblogs.com/zero-begin/p/4350038.html
Copyright © 2011-2022 走看看