toj4119HDFS
In HDFS( Hadoop Distributed File System), each data may have a lot of copies in case of data lose. This problem, every data has its own id, from 1 to n. To make things simple, each data has only two copies. This time, the HDFS is cracked by some stupid reason. Fortunately, tmeteorj knows that there are actually 2 data lost by his keen intuition. Now, it is your time to show your value of life. You should tell tmeteorj the id of lost data.
INPUT
First line, there will a number T(1≤T≤10), means the test case of this problem. After this, each line is first a number n(1≤n≤5000000), means data id is from 1 to n. Then there will be 2(n-1) numbers means the id of data in health state.
OUTPUT
For each case, print the lost id of data. The smaller id is in the front of the bigger one.
Sample Input
3
4 1 1 2 3 4 4
4 1 2 3 1 2 4
4 2 3 4 2 3 1
Sample Output
2 3
3 4
1 4
Source: TJU School Competetion 2015
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath> using namespace std; int main()
{
long long n,i,a,b,x,y,d,z;
cin>>z;
while(z--)
{
cin>>n;
a = ,b = ;
for(i = ;i<*n-;i++)
{
long long t;
scanf("%lld",&t);
a += n-i/-t;
b += (n-i/)*(n-i/)-t*t; }
d = sqrt(*b-a*a);
x = (a-d)/,y = (a+d)/;
cout<<x<<" "<<y<<endl;
}
return ;
}
toj4119HDFS的更多相关文章
随机推荐
- Linux 与 unix shell编程指南——学习笔记
第一章 文件安全与权限 文件访问方式:读,写,执行. 针对用户:文件属主,同组用户,其它用户. 文件权限位最前面的字符代表文件类型,常用的如 d 目录:l 符号链 ...
- 对Lucene PhraseQuery的slop的理解[转载]
所谓PhraseQuery,就是通过短语来检索,比如我想查“big car”这个短语,那么如果待匹配的document的指定项里包含了"big car"这个短语,这个documen ...
- C#总结(3)
这次我们来谈谈函数. C#的函数分为静态函数,和普通函数. 先上代码. using System; using System.Collections.Generic; using System.Lin ...
- 读《疯狂Ajax讲义》重点
1.XMLHttpRequest() 请求的写法(p62) 一个类XMLHttp 因该包含的接口:[1] XMLHttp.sendRequest("POST",URL,data, ...
- (原)caffe中通过图像生成lmdb格式的数据
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5909121.html 参考网址: http://www.cnblogs.com/wangxiaocvp ...
- Mapper映射语句高阶应用——ResultMap
resultMap 元素是MyBatis 中最重要最强大的元素.它就是让你远离 90%的需要从结果 集中取出数据的 JDBC代码的那个东西, 而且在一些情形下允许你做一些 JDBC 不支持的事 情. ...
- python运维开发(十八)----Django(二)
内容目录 路由系统 模版 Ajax model数据库操作,ORM 路由系统 django中的路由系统和其他语言的框架有所不同,在django中每一个请求的url都要有一条路由映射,这样才能将请求交给对 ...
- backboneJS 使用心得(2)view和model事件的多次绑定(转载)
一,new 一个新的View对象时,最好把,el参数传进去:而不是在view里面操作view的外部节点. 比如: 外部调用 var view=new BankboneView({el,$('body' ...
- CentOS安装错误:no default or ui configuration
靠,以后再也不用浏览器自带的下载工具下载镜像文件了,原来是下载的不完整,但是显示完全下载完毕了,真特么误导人.文件的checksum不对. references: https://www.centos ...
- Ice笔记-利用Ice::Application类简化Ice应用
Ice笔记-利用Ice::Application类简化Ice应用 作者:ydogg,转载请申明. 在编写Ice相关应用时,无论是Client还是Server端,都必须进行一些必要的动作,如:Ice通信 ...