fzoj1314 You are my brother
题目描述
Little A gets to know a new friend, Little B, recently. One day, they realize that they are family 500 years ago. Now, Little A wants to know whether Little B is his elder, younger or brother.
输入
There are multiple test cases.
For each test case, the first line has a single integer, n (n<=1000). The next n lines have two integers a and b (1<=a,b<=2000) each, indicating b is the father of a. One person has exactly one father, of course. Little A is numbered 1 and Little B is numbered 2.
Proceed to the end of file.
输出
For each test case, if Little B is Little A’s younger, print “You are my younger”. Otherwise, if Little B is Little A’s elder, print “You are my elder”. Otherwise, print “You are my brother”. The output for each test case occupied exactly one line.
样例输入
5
1 3
2 4
3 5
4 6
5 6
6
1 3
2 4
3 5
4 6
5 7
6 7
样例输出
You are my elder
You are my brother
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
int n;
while(cin>>n)
{
int a,b,la=,lb=,da=,db=;
for(int i=;i<=n;i++)
{
cin>>a>>b;
if(la==a){la=b;da++;}
if(lb==a){lb=b;db++;}
}
if(db<da)cout<<"You are my elder"<<endl;
else if(db==da) cout<<"You are my brother"<<endl;
else if(db>da) cout<<"You are my younger"<<endl;
}
return ;
}
fzoj1314 You are my brother的更多相关文章
- 远程监控显示brother数控机床数据
最近几个月公司太忙了,到现在已经连续出差两个多月了. 这个项目这要做mes系统,涉及到产品在机床的加工过程监控,然后led看板显示产品进度. 这里的主角是日本的brother数控机床,服务器按照一定频 ...
- Ubuntu 安装 Brother MFC7470D 驱动
Ubuntu 安装 Brother MFC7470D 驱动 办公室的打印机是 Brother MFC7470D ,在 Ubuntu 中安装打印机驱动时,发现没有这个型号的驱动.只有 MFC7450 的 ...
- FJNU 1154 Fat Brother And His Love(胖哥与女神)
FJNU 1154 Fat Brother And His Love(胖哥与女神) Time Limit: 2000MS Memory Limit: 257792K [Description] [ ...
- FJNU 1153 Fat Brother And XOR(胖哥与异或)
FJNU 1153 Fat Brother And XOR(胖哥与异或) Time Limit: 1000MS Memory Limit: 257792K [Description] [题目描述] ...
- FJNU 1155 Fat Brother’s prediction(胖哥的预言)
FJNU 1155 Fat Brother’s prediction(胖哥的预言) Time Limit: 1000MS Memory Limit: 257792K [Description] [ ...
- FJNU 1152 Fat Brother And Integer(胖哥与整数)
FJNU 1152 Fat Brother And Integer(胖哥与整数) Time Limit: 1000MS Memory Limit: 257792K [Description] [题 ...
- FJNU 1156 Fat Brother’s Gorehowl(胖哥的血吼)
FJNU 1156 Fat Brother’s Gorehowl(胖哥的血吼) Time Limit: 1000MS Memory Limit: 257792K [Description] [题目 ...
- FJNU 1151 Fat Brother And Geometry(胖哥与几何)
FJNU 1151 Fat Brother And Geometry(胖哥与几何) Time Limit: 1000MS Memory Limit: 257792K [Description] [ ...
- FJNU 1157 Fat Brother’s ruozhi magic(胖哥的弱智术)
FJNU 1157 Fat Brother’s ruozhi magic(胖哥的弱智术) Time Limit: 1000MS Memory Limit: 257792K [Description ...
随机推荐
- Linux 信号(三)—— sigaction 函数
ilocker:关注 Android 安全(新入行,0基础) QQ: 2597294287 #include <signal.h> int sigaction(int signo, con ...
- UVALive - 4108 SKYLINE[线段树]
UVALive - 4108 SKYLINE Time Limit: 3000MS 64bit IO Format: %lld & %llu Submit Status uDebug ...
- Redis的安装
1. 中文官网:http://www.redis.cn/download.html 英文官网:http://www.redis.io/download 里面的内容的一样的,就是一个是中文写的,一个是英 ...
- 如何使用eclipse打开已有工程
在开始使用Eclipse的时候,会发现一个问题,那就是如何打开一个现有的Eclipse工程,开始在菜单中找了好久也没找到. 其实,Eclipse生成的结果不像VC,Jcreator那样可以直接打开,若 ...
- CRC校验码原理、实例、手动计算
目录一.CRC16实现代码二.CRC32编码字符表三.CRC校验码的手动计算示例四.CRC校验原理五.CRC的生成多项式参考 一.CRC16实现代码 思路:取一个字符(8bit),逐位检查该字符,如果 ...
- jquery修改css样式,样式带!important
由于需求的需要,今天在用jquery修改一个弹出框的样式的时候,由于有一个按钮有padding-left:12px;导致内间距空出来的这一块颜色用普通的方式无法改变. 普通的jquery修改css的方 ...
- javascript马赛克遮罩图片切换效果:XMosaic.js(转)
新鲜出炉的javascript图片切换特效,实现的是马赛克遮罩切换.在flash里,好实现遮罩动画很简单,不过JS实现起来就有些困难了. XMosaic.js,与XScroll.js和XScroll2 ...
- LeetCode 笔记系列13 Jump Game II [去掉不必要的计算]
题目: Given an array of non-negative integers, you are initially positioned at the first index of the ...
- JavaScript实现计算两个日期之间的天数
以“yyyy-MM-dd”格式为例,现在有两个日期,分别为“2006-01-01”,“2007-05-20”. 1.调用Date.parser()方法,将字符串格式的时间戳转换为Date类型时间对象: ...
- 【MVVM】模型认识理解,
MVVM:模型-视图-视图模型(Model-View-ViewModel) 注意:它是双向绑定的 源:http://www.ruanyifeng.com/blog/2015/02/mvcmvp_mv ...