Codeforces Round #260 (Div. 2)AB
http://codeforces.com/contest/456/problem/A
1 second
256 megabytes
standard input
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.
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.
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
2
1 2
2 1
Happy Alex ------------------------------------------------------------------------------------------------
1 second
256 megabytes
standard input
standard output
Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:
(1n + 2n + 3n + 4n) mod 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).
The single line contains a single integer n (0 ≤ n ≤ 10105). The number doesn't contain any leading zeroes.
Print the value of the expression without leading zeros.
4
4
124356983594583453458888889
0
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的更多相关文章
- 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) ...
- 递推DP Codeforces Round #260 (Div. 1) A. Boredom
题目传送门 /* DP:从1到最大值,dp[i][1/0] 选或不选,递推更新最大值 */ #include <cstdio> #include <algorithm> #in ...
- Codeforces Round #713 (Div. 3)AB题
Codeforces Round #713 (Div. 3) Editorial 记录一下自己写的前二题本人比较菜 A. Spy Detected! You are given an array a ...
- Codeforces Round #259 (Div. 2)AB
链接:http://codeforces.com/contest/454/problem/A A. Little Pony and Crystal Mine time limit per test 1 ...
- 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 ...
- Codeforces Round #260 (Div. 1) C. Civilization 并查集,直径
C. Civilization Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/455/probl ...
- 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 ...
- Codeforces Round #260 (Div. 1) A. Boredom (简单dp)
题目链接:http://codeforces.com/problemset/problem/455/A 给你n个数,要是其中取一个大小为x的数,那x+1和x-1都不能取了,问你最后取完最大的和是多少. ...
- Codeforces Round #555 (Div. 3) AB
A: http://codeforces.com/contest/1157/problem/A 题意:每次加到10的整数倍之后,去掉后面的0,问最多有多少种可能. #include <io ...
随机推荐
- [转]编译Android源代码常见错误解决办法
1. 编译时出现/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libz.so when ...
- linux strace
yum install -y strace 若某一进程占用cpu高可以用strace -p pid进行跟踪查看 strace常用来跟踪进程执行时的系统调用和所接收的信号. 在Linux世界,进程不能直 ...
- lamp环境编译(apache2.4.7 php5.4.25 mysql 5.5.23)
环境要求 gcc.gcc-c++.cmake.bison(可能)支持 1.yum install gcc gcc-c++ cmake bison 2.修改yum配置,达到搜索本地设置 移走或改名/et ...
- Linux之sed命令详解
简介 sed 是一种在线编辑器,它一次处理一行内容.处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”(pattern space),接着用sed命令处理缓冲区中的内容,处理完成后,把缓冲区的 ...
- BlueDroid介绍 【转】
转自:http://blog.csdn.net/fen_liu/article/details/41213167 [-] 基本结构 代码区 http://www.cnblogs.com/hzl6255 ...
- Hibernate,Session方法使得java对象进入持久化状态;持久化对象特征
以下情况java对象进入持久化状态: session.save()方法把临时对象转变为持久化对象. session.load()和session.get()方法得到的对象总是处于持久化状态. sess ...
- [算法][包围盒]球,AABB,OBB
参考地址请看图片水印:http://www.cnblogs.com/iamzhanglei/archive/2012/06/07/2539751.html http://blog.sina.com.c ...
- 查找素数(0~1000)的算法(Java代码)
1.一般方法,设置标兵,进行查找 class prime{ //检查是否是素数 public void isPrime(){ ; ;i<=;i++){ ; ;j<i;j++){ ){ co ...
- Oracle找出非数字
可以这样判断: select translate('99999999999999', '\1234567890', '\') from dual; 返回的是空 select translate(' ...
- JVM的classloader(转)
Java中一共有四个类加载器,之所以叫类加载器,是程序要用到某个类的时候,要用类加载器载入内存. 这四个类加载器分别为:Bootstrap ClassLoader.Extension Class ...