题目意思还是蛮简单的,看 输入数据输出数据还是比较明显的

我用排序来写还是可以AC的

//#pragma comment(linker, "/STACK:16777216") //for c++ Compiler
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <cstring>
#include <cmath>
#include <stack>
#include <string>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <vector>
#include <algorithm>
#define Max(a,b) (((a) > (b)) ? (a) : (b))
#define Min(a,b) (((a) < (b)) ? (a) : (b))
#define Abs(x) (((x) > 0) ? (x) : (-(x)))
#define MOD 1000000007
#define pi acos(-1.0) using namespace std; typedef long long ll ;
typedef unsigned long long ull ;
typedef unsigned int uint ;
typedef unsigned char uchar ; template<class T> inline void checkmin(T &a,T b){if(a>b) a=b;}
template<class T> inline void checkmax(T &a,T b){if(a<b) a=b;} const double eps = 1e- ;
const int N = ;
const int M = * ;
const ll P = 10000000097ll ;
const int MAXN = ;
const int INF = 0x3f3f3f3f ;
const int offset = ; int a[], b[], c[];
int n; int main () {
std::ios::sync_with_stdio (false);
int i, j, t, k, u, v, numCase = ; cin >> n;
for (i = ; i < n; ++i) cin >> a[i];
for (i = ; i < n - ; ++i) cin >> b[i];
for (i = ; i < n - ; ++i) cin >> c[i]; sort (a, a + n);
sort (b, b + n - );
sort (c, c + n - ); for (i = ; i < n - ; ++i) {
if (a[i] != b[i]) {
cout << a[i] << endl;
break;
}
}
if (i == n - ) {
cout << a[n - ] << endl;
} for (i = ; i < n - ; ++i) {
if (b[i] != c[i]) {
cout << b[i] << endl;
break;
}
}
if (i == n - ) {
cout << b[n - ] << endl;
} return ;
}

Sort Solution

不过看了官方题解,还有更快的方法。

因为这题的数据规模在 n - 10^5  ai - 10 ^ 9 ,如果对所有的数字作一个累加的话还是可以存放在 long long 类型的变量中

Source Code:

/****************************************
** Solution by Bekzhan Kassenov **
****************************************/ #include <bits/stdc++.h> using namespace std; #define F first
#define S second
#define MP make_pair
#define all(x) (x).begin(), (x).end() typedef long long ll;
typedef unsigned long long ull;
typedef long double ld; const double EPS = 1e-;
const double PI = acos(-1.0);
const int MOD = * * + ;
const int INF = * * ; template <typename T>
inline T sqr(T n) {
return n * n;
} int n, x;
long long a, b, c; int main() {
#ifndef ONLINE_JUDGE
freopen("in", "r", stdin);
#endif scanf("%d", &n); for (int i = ; i < n; i++) {
scanf("%d", &x);
a += x;
} for (int i = ; i < n - ; i++) {
scanf("%d", &x);
b += x;
} for (int i = ; i < n - ; i++) {
scanf("%d", &x);
c += x;
} printf("%I64d\n%I64d\n", a - b, b - c); return ;
}

CodeForces 519B A and B and Compilation Errors【模拟】的更多相关文章

  1. CodeForces 519B A and B and Compilation Errors

    B. A and B and Compilation Errors time limit per test 2 seconds memory limit per test 256 megabytes ...

  2. CodeForces 519B A and B and Compilation Errors (超水题)

    这道题是超级水的,在博客上看有的人把这道题写的很麻烦. 用 Python 的话是超级的好写,这里就奉上 C/C++ 的AC. 代码如下: #include <cstdio> #includ ...

  3. Codeforce 519B - A and B and Compilation Errors

    A and B are preparing themselves for programming contests. B loves to debug his code. But before he ...

  4. Codeforces Round #294 (Div. 2)B - A and B and Compilation Errors 水题

    B. A and B and Compilation Errors time limit per test 2 seconds memory limit per test 256 megabytes ...

  5. CF A and B and Compilation Errors (排序)

    A and B and Compilation Errors time limit per test 2 seconds memory limit per test 256 megabytes inp ...

  6. Warning: Function created with compilation errors.

    SQL> create or replace function 2 remove_constants(p_query in varchar2) return varchar2 3 as 4 l_ ...

  7. codeforces 373 A - Efim and Strange Grade(算数模拟)

    codeforces 373 A - Efim and Strange Grade(算数模拟) 原题:Efim and Strange Grade 题意:给出一个n位的实型数,你可以选择t次在任意位进 ...

  8. Warning: Function created with compilation errors!

    解决方案: sqlplus / as sysdba grant execute on UTL_I18N to scott; grant execute on DBMS_CRYPTO to scott;

  9. oracle 存储过程创建报错 Procedure created with compilation errors

    出现这错误的话,存储过程还是会成功创建的,创建好后再逐个打开查找存储过程的问题 问题:基本上就是存储过程里面的表不存在,dblink 不存在    ,用户名.xx表  要么用户名不存在要么表不存在 创 ...

随机推荐

  1. ajax+php如何获取部分请求的信息显示在对应的div中

    我该如何把需要显示的信息显示在文章列表中呢???

  2. HTML+CSS笔记 CSS进阶续集

    元素分类 在CSS中,html中的标签元素大体被分为三种不同的类型:块状元素.内联元素(又叫行内元素)和内联块状元素. 常用的块状元素有: <div>.<p>.<h1&g ...

  3. GPL协议

    GPL-General Public License 它是自由软件许可(Free Software Licence),保证最终使用者能够自由的引用,学习,拷贝,甚至修改软件.在理解这之前需要了解什么是 ...

  4. 03-C语言编码规范和变量

    目录: 一.C语言的编码规范 二.变量 三.浮点型float 四.变量名命名规则 五.变量作用域与生命周期 回到顶部 一.C语言的编程规范 1 语句可以分开放在任意位置 2 空格可以让代码更清晰 3 ...

  5. docker4dotnet

    docker4dotnet #1 – 前世今生 & 世界你好   作为一名.NET Developer,这几年看着docker的流行实在是有些眼馋.可惜的是,Docker是基于Linux环境的 ...

  6. linux 的 ping 原理

    ping命令的工作原理是: ping命令是用来查看网络上另一个主机系统的网络连接是否正常的一个工具. 他向网络上的另一个主机系统发送ICMP报文,如果指定系统得到了报文,它将把报文原样传回给发送者,这 ...

  7. 如何使用robots不让百度和google收录

    如何使用robots不让百度和google收录   有没有想过,如果我们某个站点不让百度和google收录,那怎么办? 搜索引擎已经和我们达成一个约定,如果我们按约定那样做了,它们就不要收录. 这个写 ...

  8. jQuery.fn.serialize 阅读

    今天第一次阅读jQuery源码,因为读到用js对表单的序列化,为的是在ajax操作中将表单中各个域的值传到服务器.书上用了很长的步骤,判断每一个表单域的属性,然后拼接. 大概是这样: function ...

  9. BZOJ 3385: [Usaco2004 Nov]Lake Counting 数池塘

    题目 3385: [Usaco2004 Nov]Lake Counting 数池塘 Time Limit: 1 Sec  Memory Limit: 128 MB Description     农夫 ...

  10. BZOJ 1023

    program bzoj1023; uses math; ; maxn=; maxm=; type edge=record togo,next:longint; end; var n,m,cnt,in ...