HDU 2143 BOX (水题)
2014-05-27 09:08
330 查看
box
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7091 Accepted Submission(s): 1419
Problem Description
One day, winnie received a box and a letter. In the letter, there are three integers and five operations(+,-,*,/,%). If one of the three integers can be calculated by the other two integers using any operations only once.. He can open that mysterious box. Or
that box will never be open.
Input
The input contains several test cases.Each test case consists of three non-negative integers.
Output
If winnie can open that box.print "oh,lucky!".else print "what a pity!"
Sample Input
1 2 3
Sample Output
oh,lucky!
Author
kiki
Source
HDU 2007-11 Programming Contest
Recommend
威士忌 | We have carefully selected several similar problems for you: 2115 2164 2549 2709 2145
水题
注意:
1、__int64()数据;
2、除和取余时考虑一下0;
3、除时注意转换类型,(double)/(double)
#include<stdio.h> int main() { int i,j,k,p; __int64 a[3]; while(scanf("%I64d%I64d%I64d",&a[0],&a[1],&a[2])!=EOF) { p=0; for(i=0;i<3;i++) for(j=0;j<3;j++) for(k=0;k<3;k++) { if(i!=j&&i!=k&&j!=k) { if(a[i]+a[j]==a[k]){ p=1;goto loop;} if(a[i]-a[j]==a[k]){ p=1;goto loop;} if(a[i]*a[j]==a[k]){ p=1;goto loop;} if(a[j]!=0) { if(a[i]%a[j]==a[k]){ p=1;goto loop;} if((double)a[i]/(double)a[j]==(double)a[k]){ p=1;goto loop;} } } } loop: if(p) printf("oh,lucky!\n"); else printf("what a pity!\n"); } return 0; }
相关文章推荐
- HDOJ(HDU) 2143 box(简单的多次判断-用的卫条件)
- HDU 2143 box
- HDOJ(HDU) 2143 box(简单的多次判断-用的卫条件)
- HDU 2143 box
- HDU 1326 Box of Bricks(水题)
- hdu 2143 box
- hdu-5003 Osu!(水题)
- hdu 1325 水题
- HDU--杭电--1686--Oulipo--KMP--水题
- HDU-1034 Candy Sharing Game 模拟问题(水题)
- hdu 3650 杭州赛水题
- HDU 2040--亲和数【水题】
- HDU 1999 不可摸数 (水题)
- HDU 6066 17多校3 RXD's date(超水题)
- HDU 5551 Huatuo's Medicine(水题)
- hdu 5904 水题
- hdu 1012:u Calculate e(数学题,水题)
- HDU 2089 不要62 --- 水题+打表
- HDU 6140 Hybrid Crystals【阅读题】【水题】
- HDU 1234 开门人和关门人(模拟水题)