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表 要么用户名不存在要么表不存在 创 ...
随机推荐
- Oracle系统视图
VIEW TABLES 1.DBA_TABLES --查看系统里所有表的信息,只有DBA权限用户才可查看 SELECT * FROM DBA_TABLES WHERE OWNER='HR' AND T ...
- Python keyword 模块 -- 学习笔记
keyword 的帮助文档 >>> import keyword >>> help(keyword) Help on module keyword: NAME ke ...
- 通过读取excel数据和mysql数据库数据做对比(二)-代码编写测试
通过上一步,环境已搭建好了. 下面开始实战, 首先,编写链接mysql的函数conn_sql.py import pymysql def sql_conn(u,pwd,h,db): conn=pymy ...
- ASP.net WebAPI 上传图片
[HttpPost] public Task<Hashtable> ImgUpload() { // 检查是否是 multipart/form-data if (!Request.Cont ...
- NET Core Docker部署
NET Core Docker部署 前言 在前面文章中,介绍了 ASP.NET Core在 macOS,Linux 上基于Nginx和Jexus的发布和部署,本篇文章主要是如何在Docker容器中运行 ...
- AttributeError: 'module' object has no attribute 'Thread'
$ python thread.py starting at: 2015-08-05 00:24:24Traceback (most recent call last): File "th ...
- Poj 1166 The Clocks(bfs)
题目链接:http://poj.org/problem?id=1166 思路分析:题目要求求出一个最短的操作序列来使所有的clock为0,所以使用bfs: <1>被搜索结点的父子关系的组织 ...
- 使用Lock实现信号量
public class SemaphoreOnLock { private final Lock lock = new ReentrantLock(); private fi ...
- [置顶] 使用mongofiles操作GridFS
使用mongofiles操作GridFS GridFS描述: GridFS,看起来像一种文件系统,其实是一种数据库用法.主要用来在数据库中存储二进制大文件.可以统一用数据库处理数据,而无需借助外部的文 ...
- Shot(三分)
Shot Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submis ...