POJ 3386 Halloween Hoildays(我的水题之路——两个戒指)
2012-02-14 19:52
344 查看
Halloween Holidays
Description
Planet Cucurbita is inhabited with intelligent pumpkins. These pumpkins are not only extremely clever, they also are fond of tourism. One of their main routes is the Earth during Halloween.
As you know, pumpkins cannot move by themselves (intelligent pumpkins are not an exception), so they make somebody else to transport them. In the case of Halloween this is done by humans. First, they make people to grow special biological docking stations,
then prepare the stations (people cut special holes, fire candles etc – you know the procedure), and after these preparations pumpkins come and have fun. People usually do not see anything and think that this is just a holiday and that this holiday is for
humans, but remember – if somebody is frightened at Halloween, he was frightened not by his not-very-friendly friends, but by alien pumpkins.
To use the biological docking station, a pumpkin must have a special transmitter. It’s main elements are two rings made of gold and for some unexplainable reasons these rings should be cut from one round plate. The sizes of these rings (inner and outer radii)
are pumpkin-specific, so each alien should order a special set for himself.
Mr. Calabaza, an adolescent pumpkin, wants to make his first trip to the Earth. He found a discount plate, which was not redeemed by a previous customer, and it is necessary to check, whether this plate allows Mr. Calabaza to cut the rings he needs from
it, or he should order a new larger plate.
Input
The input file contains five integer numbers A, a, B, b, P (0 < A, a, B, b, P ≤ 1 000 000, a < A and b < B), separated
with spaces. Here, A and B are the outer radii of the rings, a and b are the inner radii of the corresponding rings, and P is the plate radius.
Output
Output a word “Yes” if the plate suits Mr. Calabaza, or a word “No” if he needs to order another one.
Sample Input
Sample Output
Hint
Source
Northeastern Europe 2006, Northern Subregion
需要在一个半径为P的金盘上扣下两个圆环做戒指,两个戒指的外半径分别为A、B,内半径分别为a、b。问是否可以在这个金盘上得到这两个戒指。
根据Hint里的图,知道两个戒指是套在一起的,所以只需要比较是否里面戒指的外半径小于外部戒指的内半径,外部戒指的外半径是是否小于金盘外半径,或者,两个外半径相加小于金盘半径(两个戒指并排)。
代码(1AC):
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 2787 | Accepted: 1120 |
Planet Cucurbita is inhabited with intelligent pumpkins. These pumpkins are not only extremely clever, they also are fond of tourism. One of their main routes is the Earth during Halloween.
As you know, pumpkins cannot move by themselves (intelligent pumpkins are not an exception), so they make somebody else to transport them. In the case of Halloween this is done by humans. First, they make people to grow special biological docking stations,
then prepare the stations (people cut special holes, fire candles etc – you know the procedure), and after these preparations pumpkins come and have fun. People usually do not see anything and think that this is just a holiday and that this holiday is for
humans, but remember – if somebody is frightened at Halloween, he was frightened not by his not-very-friendly friends, but by alien pumpkins.
To use the biological docking station, a pumpkin must have a special transmitter. It’s main elements are two rings made of gold and for some unexplainable reasons these rings should be cut from one round plate. The sizes of these rings (inner and outer radii)
are pumpkin-specific, so each alien should order a special set for himself.
Mr. Calabaza, an adolescent pumpkin, wants to make his first trip to the Earth. He found a discount plate, which was not redeemed by a previous customer, and it is necessary to check, whether this plate allows Mr. Calabaza to cut the rings he needs from
it, or he should order a new larger plate.
Input
The input file contains five integer numbers A, a, B, b, P (0 < A, a, B, b, P ≤ 1 000 000, a < A and b < B), separated
with spaces. Here, A and B are the outer radii of the rings, a and b are the inner radii of the corresponding rings, and P is the plate radius.
Output
Output a word “Yes” if the plate suits Mr. Calabaza, or a word “No” if he needs to order another one.
Sample Input
2 1 5 3 6
Sample Output
Yes
Hint
Source
Northeastern Europe 2006, Northern Subregion
需要在一个半径为P的金盘上扣下两个圆环做戒指,两个戒指的外半径分别为A、B,内半径分别为a、b。问是否可以在这个金盘上得到这两个戒指。
根据Hint里的图,知道两个戒指是套在一起的,所以只需要比较是否里面戒指的外半径小于外部戒指的内半径,外部戒指的外半径是是否小于金盘外半径,或者,两个外半径相加小于金盘半径(两个戒指并排)。
代码(1AC):
#include <cstdio> #include <cstdlib> int main(void){ int A, a, B, b, P; while (scanf("%d%d%d%d%d", &A, &a, &B, &b, &P) != EOF){ if (A <= b && B <= P || B <= a && A <= P || A + B <= P){ printf("Yes\n"); } else{ printf("No\n"); } } return 0; }
相关文章推荐
- POJ 2105 IP Address(我的水题之路——二进制字符转换成十进制)
- POJ 2562 Primary Arithmetic(我的水题之路——模拟加法进位)
- POJ 2840 Big Clock(我的水题之路——水,钟)
- POJ 1493 Machined Surfaces(我的水题之路——移动后的空格)
- POJ 2013 Symmetric Order(我的水题之路——奇偶输出)
- POJ 2019 Cornfields(我的水题之路——多case??TLE??)
- POJ 2141 Message Decowding(我的水题之路——简单解密)
- POJ 2575 Jolly Jumpers(我的水题之路——数组绝对差值为1到n-1)
- POJ 2864 Pascal Library(我的水题之路——都来了么)
- POJ 3062 Celebrity jeopardy(我的水题之路——原样输出)
- POJ 3300 Tour de France(我的水题之路——车轮角速度最大)
- POJ 1298 The Hardest Problem Ever(我的水题之路——解密,水题)
- POJ 1488 TEX Quotes(我的水题之路——暴水,字符转换)
- POJ 3302 Subsequence(我的水题之路——子串判断)
- POJ 1316 Self Numbers(我的水题之路——筛法)
- POJ 1484 Blowing Fuses(我的水题之路——我必须在心中牢记这次惨痛的教训)
- POJ 2028 When Can We Meet?(我的水题之路——边输入,边搜索)
- POJ 2159 Ancient Cipher(我的水题之路——双重加密)
- POJ 2578 Keep on Truckin'(我的水题之路——谁先大于168)
- POJ 3077 Rounders(我的水题之路——高精度四舍五入)