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 ...
随机推荐
- linux设备驱动归纳总结(三):1.字符型设备之设备申请【转】
本文转载自:http://blog.chinaunix.net/uid-25014876-id-59416.html linux设备驱动归纳总结(三):1.字符型设备之设备申请 操作系统:Ubunru ...
- STM32内存跟FLASH问题
RO: 常量 ZI: 未初始化的全局变量 RW: 初始化的全局变量 Code: 程序本身 Code, RO-data,RW-data ..............flash RW-data, ZIda ...
- Backup: Array in Perl6
Array in Perl6 继承List,而List又继承Iterable,Positional,Cool ARRAY.pop ARRAY.shift ARRAY.push: VALUES ARRA ...
- android 中 listview 设置自动匹配高度
1.布局文件 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:l ...
- Oracle主库归档丢失,备库日志有gap,在不重建备库的情况下,恢复备库
本文主要描述Oracle备库日志与主库日志之间有gap,切主库这部分gap的归档日志已经删除或丢失,如何在不重建备库的情况下,恢复备库. 欢迎转载,请注明作者.出处. 作者:张正 blog:http: ...
- 让ecshop用户登录评价以可择匿名评价
ECSHOP 默认的程序 是 当用户登录后,对商品商品评价是不是能匿名评价的. 有些店铺设置了只能登录评价,但客户又不想显示自己的账号名称.这时候 这功能 就可以派上用场了 1在 comment.ph ...
- C语言中%*s,%*c 是什么意思(还有%*.*s)
在 scanf 和 printf 里效果是不一样的. 在printf,动态控制显示格式用的 printf("%*s",5,"123");执行一下,这条语句,输出 ...
- java文件写入和读出的序列化
文件的写入入与读出都有它们自己的格式,不便于读入和取出,implement Serializable接口,实现任何个事文件的写入和读取取:
- Unity脚本在层级面板中的执行顺序测试4-附加整理
测试4为一些附加内容,后续的各种tips都加在此. 前几篇测试的链接: Unity脚本在层级面板中的执行顺序测试1 http://www.cnblogs.com/hont/p/4298110.html ...
- JAVA基础知识之网络编程——-基于AIO的异步Socket通信
异步IO 下面摘子李刚的<疯狂JAVA讲义> 按照POSIX标准来划分IO,分为同步IO和异步IO.对于IO操作分为两步,1)程序发出IO请求. 2)完成实际的IO操作. 阻塞IO和非阻塞 ...