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的更多相关文章
随机推荐
- SQL server根据值搜表名和字段
DECLARE @what varchar(800) SET @what='lll' --要搜索的字符串 DECLARE @sql varchar(8000) DECLARE TableCursor ...
- mysql 数据库连接池
hibernate配置C3P0详解 分类: hibernate 2013-08-14 16:16 1213人阅读 评论 ...
- XML 解析中,如何排除控制字符
XML 解析中,如何排除控制字符 今天在解析一个中文的 XML时,始终报错 PCDATA invalid Char value 21 in Entity ,查询了一下这个 21 的ascii 值,发现 ...
- TCP粘包/拆包问题的解决
TCP粘包拆包问题 一个完整的包可能被TCP拆分成多个包,或多个小包封装成一个大的数据包发送. 解决策略 消息定长,如果不够,空位补空格 在包尾增加回车换行符进行分割,例如FTP协议 将消息分为消息头 ...
- 浅谈Linux系统的启动流程
Linux系统的启动时通过读取不同的配置文件,执行相应的Shell脚本完成的.当然本文只是简单的从文件的角度分析,更深层次的本文没涉及. 主要读取了以下文件: /boot/grub/grub.con ...
- Spring连接MySQL、Oracle和SQL Server的数据库运动连接属性
在配置文件applicationContext.xml设置如下:<?xml version="1.0" encoding="UTF-8"?>< ...
- FATE(费用背包,没懂)
FATE Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submis ...
- service2008 word 导入导出 配置问题
除了配置 com组件权限 64位系统还要加 下面的文件 C:\Windows\SysWOW64\config\systemprofile\Desktop C:\Windows\Temp 也要加权限
- POP3、SMTP、IMAP和Exchange都是个什么玩意?
很多时候一直对POP3.SMTP.IMAP和Exchange等迷迷糊糊的.下面就整理说明一下: 当前常用的电子邮件协议有SMTP.POP3.IMAP4,它们都隶属于TCP/IP协议簇,默认状态下,分别 ...
- 【ASP.NET MVC路由测试+性能调试工具】
http://getglimpse.com https://github.com/Glimpse/Glimpse 百度网盘: http://pan.baidu.com/s/1jHuTtKa