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

我用排序来写还是可以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. php文件链接数据库基本代码

    <?php $conn=@mysql_connect("localhost","root",""); if($conn==null) ...

  2. html文件中文在浏览器中显示乱码问题解决

    利用浏览器打开html文件时,中文显示乱码,如下是原文件的内容 1 <html>   2         <head>   3             <title> ...

  3. 目前网络上大部分的网站都是由ASP或PHP开发,并且java平台的软件购买成本不适合中小企业客户,一般适用于银行、国家安全等行业领域

    目前网络上大部分的网站都是由ASP或PHP开发,并且java平台的软件购买成本不适合中小企业客户,一般适用于银行.国家安全等行业领域. 要求建设开发大型复杂的网站,但仅有一个idea,不能够提供网站详 ...

  4. 文本相似度算法——空间向量模型的余弦算法和TF-IDF

    1.信息检索中的重要发明TF-IDF TF-IDF是一种统计方法,TF-IDF的主要思想是,如果某个词或短语在一篇文章中出现的频率TF高,并且在其他文章中很少出现,则认为此词或者短语具有很好的类别区分 ...

  5. apache添加fastcgi支持

    A,安装apache服务器和fastcgi模块支持(ubuntu测试) sudo apt-get install apache2 sudo apt-get install libapache2-mod ...

  6. 移动开发语言Swift

    苹果公布了全新的编程语言Swift,Swift继承了Objective-C语言特性,并从Python和Java Script中长处,使Swift更易读.未来swift编程语言的会特大广大的使用 Swi ...

  7. 离线安装.NET 3.5小记

    最近为系统新增一个功能,写完以后进行部署,发现在IIS7上部署没有问题,但是IIS6上部署会出现未知情况,具体表现为取不到数据,估计是IIS6和IIS7直接的差异导致程序异常退出. 为了重现异常,在本 ...

  8. 2.3.9 用NPOI操作EXCEL--通过NPOI获得公式的返回值

    前面我们学习了通过NPOI向Excel中设置公式,那么有些读者可能会问:“NPOI能不能获取公式的返回值呢?”,答案是可以!一.获取模板文件中公式的返回值如在D盘中有一个名为text.xls的Exce ...

  9. Android目录结构介绍&Android学习之hello world

    分类: 嵌入式 一个android项目有如下目录: src:这里放的是我们编写的源代码 gen:这里的是eclipse自动生成的文件,不用管它 asssts:放置文件 res:也是放置文件,不同的是r ...

  10. Android Studio does not point to a valid jvm

    环境变量 JAVA_HOME的值,去掉后面的分号,一般情况下就可以启动