http://codeforces.com/contest/456/problem/A

A. Laptops
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality of the first laptop is higher (strictly greater) than the quality of the second laptop.

Please, check the guess of Alex. You are given descriptions of n laptops. Determine whether two described above laptops exist.

Input

The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops.

Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality).

All ai are distinct. All bi are distinct.

Output

If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).

Sample test(s)
input
2
1 2
2 1
output
Happy Alex

------------------------------------------------------------------------------------------------
B. Fedya and Maths
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:

(1n + 2n + 3n + 4nmod 5

for given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).

Input

The single line contains a single integer n (0 ≤ n ≤ 10105). The number doesn't contain any leading zeroes.

Output

Print the value of the expression without leading zeros.

Sample test(s)
input
4
output
4
input
124356983594583453458888889
output
0
Note

Operation x mod y means taking remainder after division x by y.

Note to the first sample:

===============================================================================

#include <stdio.h>
#include <string.h> int main()
{
int n,m,i,j;
int a,b,c,d;
scanf("%d",&n);
//scanf("%d%d",&a,&b);
int sum=;
for(i=;i<n;i++)
{
scanf("%d%d",&c,&d);
if(c<d)
sum++;
}
if(sum>)
printf("Happy Alex\n");
else
printf("Poor Alex\n");
}
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
char str[];
int main()
{
//
int n,m,i,j;
//memset(str,0,sizeof(str));
while(scanf("%s",str)!=EOF)
{
int len=strlen(str);
int data=;
if(len == )
{
if((str[len-]-'')%==)
printf("4\n");
else printf("0\n");
continue;
}
data=(str[len-]-'')+(str[len-]-'')*;
if(data % == )
printf("4\n");
else
printf("0\n");
}
return ;
}

Codeforces Round #260 (Div. 2)AB的更多相关文章

  1. DP Codeforces Round #260 (Div. 1) A. Boredom

    题目传送门 /* 题意:选择a[k]然后a[k]-1和a[k]+1的全部删除,得到点数a[k],问最大点数 DP:状态转移方程:dp[i] = max (dp[i-1], dp[i-2] + (ll) ...

  2. 递推DP Codeforces Round #260 (Div. 1) A. Boredom

    题目传送门 /* DP:从1到最大值,dp[i][1/0] 选或不选,递推更新最大值 */ #include <cstdio> #include <algorithm> #in ...

  3. Codeforces Round #713 (Div. 3)AB题

    Codeforces Round #713 (Div. 3) Editorial 记录一下自己写的前二题本人比较菜 A. Spy Detected! You are given an array a ...

  4. Codeforces Round #259 (Div. 2)AB

    链接:http://codeforces.com/contest/454/problem/A A. Little Pony and Crystal Mine time limit per test 1 ...

  5. Codeforces Round #260 (Div. 1) D. Serega and Fun 分块

    D. Serega and Fun Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/455/pro ...

  6. Codeforces Round #260 (Div. 1) C. Civilization 并查集,直径

    C. Civilization Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/455/probl ...

  7. Codeforces Round #260 (Div. 1) A - Boredom DP

    A. Boredom Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/455/problem/A ...

  8. Codeforces Round #260 (Div. 1) A. Boredom (简单dp)

    题目链接:http://codeforces.com/problemset/problem/455/A 给你n个数,要是其中取一个大小为x的数,那x+1和x-1都不能取了,问你最后取完最大的和是多少. ...

  9. Codeforces Round #555 (Div. 3) AB

    A:    http://codeforces.com/contest/1157/problem/A 题意:每次加到10的整数倍之后,去掉后面的0,问最多有多少种可能. #include <io ...

随机推荐

  1. 【secureCRT】中文乱码问题

    Options->Session Options->Appearance->Font->新宋体 字符集:中文GB2312 ->Character encoding 为UT ...

  2. 161027、Java 中的 12 大要素及其他因素

    对于许多人来说,"原生云"和"应用程序的12要素"是同义词.本文的目的是说有很多的原生云只坚持了最初的12个因素.在大多数情况下,Java 能胜任这一任务.在本 ...

  3. flex 加载arcgis 的地图json

    var fs:FeatureSet=FeatureSet.fromJSON(JSONUtil.decode(e.result.toString())); for each(var gra:Graphi ...

  4. 【jQuery UI 1.8 The User Interface Library for jQuery】.学习笔记.5.Accordion控件

    accordion是另一个UI控件,能允许你将一组content加入相互分隔的.能够被浏览者的交互打开或关闭的panels中.因此,它大多数的content在初始化的时候是隐藏的,很像tabs控件.每 ...

  5. 搭建HTTP Live Streaming直播系统

    最近,需要将苹果的HTTP Live Streaming系统搭建起来.完全没有头绪,故第一步就是学习. 一.学习资料 官网资料 1. http://developer.apple.com/resour ...

  6. POJ 3267:The Cow Lexicon(DP)

    http://poj.org/problem?id=3267 The Cow Lexicon Time Limit: 2000MS   Memory Limit: 65536K Total Submi ...

  7. ECshop中TemplateBeginEditable 和后台编辑讲解

    在ecshop的dwt文件里面经常发现有“<!-- TemplateBeginEditable name="doctitle" -->和<!-- #BeginLi ...

  8. 【算法】简单动态规划——三逆数的O(N^2)解法!

    问题描述: 三逆数定义:给一个数的序列A[0,1,....N-1]),当i<j<k且A[i]>A[j]>A[k]时,称作ai,aj,ak为一个三逆数. 现在给定一个长度为N的数 ...

  9. Shopping(SPFA+DFS HDU3768)

    Shopping Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Sub ...

  10. php cli模式学习(PHP命令行模式)

    http://www.jb51.net/article/37796.htm php_cli模式简介  php-cli是php Command Line Interface的简称,如同它名字的意思,就是 ...