CodeForces 519B A and B and Compilation Errors【模拟】
题目意思还是蛮简单的,看 输入数据输出数据还是比较明显的
我用排序来写还是可以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【模拟】的更多相关文章
- 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 ...
- CodeForces 519B A and B and Compilation Errors (超水题)
这道题是超级水的,在博客上看有的人把这道题写的很麻烦. 用 Python 的话是超级的好写,这里就奉上 C/C++ 的AC. 代码如下: #include <cstdio> #includ ...
- 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 ...
- 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 ...
- 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 ...
- Warning: Function created with compilation errors.
SQL> create or replace function 2 remove_constants(p_query in varchar2) return varchar2 3 as 4 l_ ...
- codeforces 373 A - Efim and Strange Grade(算数模拟)
codeforces 373 A - Efim and Strange Grade(算数模拟) 原题:Efim and Strange Grade 题意:给出一个n位的实型数,你可以选择t次在任意位进 ...
- Warning: Function created with compilation errors!
解决方案: sqlplus / as sysdba grant execute on UTL_I18N to scott; grant execute on DBMS_CRYPTO to scott;
- oracle 存储过程创建报错 Procedure created with compilation errors
出现这错误的话,存储过程还是会成功创建的,创建好后再逐个打开查找存储过程的问题 问题:基本上就是存储过程里面的表不存在,dblink 不存在 ,用户名.xx表 要么用户名不存在要么表不存在 创 ...
随机推荐
- Python学习笔记 (4) :迭代器、生成器、装饰器、递归、正则表达式等
迭代器 迭代器是访问集合元素的一种方式.迭代器对象从集合的第一个元素开始访问,直到所有的元素被访问完结束.迭代器只能往前不会后退,不过这也没什么,因为人们很少在迭代途中往后退.另外,迭代器的一大优点是 ...
- iter, yield与enumerate的实现
模拟实现一个enumerate函数 def myEnumerate(seq, start=0): results = [] n = start for i in seq: results.append ...
- [转]IE和Firefox兼容性问题及解决方法
今天测试代码时,发现不少IE可以运行的ajax,但在FF中报错.IE和Firefox(火狐)在JavaScript方面的不兼容及统一方法总结如下: 1.兼容firefox的 outerHTML,FF中 ...
- 自定义标签(TagSupport )
转载:http://zhuhuide2004.iteye.com/blog/555737 这个图太好了,拿下来,标注一下:
- ubuntu安装hadoop 若干问题的解决
问题1:安装openssh-server失败 原因: 下列软件包有未满足的依赖关系: openssh-server : 依赖: openssh-client (= 1:5.9p1-5ubuntu1) ...
- asp导航条子菜单横向
示意图:(代码红色部分为主要.) <%@ Master Language="C#" AutoEventWireup="true" CodeFile=&qu ...
- citrix协议ICA技术原理
转载自: http://www.zrss.com.cn/article-110-1.html Citrix交付中心解决方式的核心是虚拟化技术,虚拟化计算的核心是ICA协议,ICA协议连接了执行在平台上 ...
- Jsp中使用EL表达式对字符串进行操作
用fn函数:<%@ taglib prefix="fn" uri="http://Java.sun.com/jsp/jstl/functions" %&g ...
- 字符串匹配算法(KMP)
字符串匹配运用很广泛,举个简单例子,我们每天登QQ时输入账号和密码,大家有没有想过账号和密码是怎样匹配的呢?登录需要多长时间和匹配算法的效率有直接的关系. 首先理解一下前缀和后缀的概念: 给出一个问题 ...
- C++中(int&)和(int)的区别
在说这个问题之前,先说两个需要知道的背景知识: (1)语言的类型的强制转换不会修改原来的数据,会另外的开辟一个临时的或者程序中指定的空间来存储强制转换后的值. (2)C++引用的实现是在符号表中动了手 ...