HDU 2143 水
来源:互联网 发布:卡通图片制作软件 编辑:程序博客网 时间:2024/05/07 16:05
box
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7848 Accepted Submission(s): 1627
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!注意浮点型不能余就行了 到除后 特殊处理#include<cstdio>#include<iostream>using namespace std;int main(){long long a,b,c;int flag;while(scanf("%lld%lld%lld",&a,&b,&c)!=EOF){flag=0;if(a+b==c||a+c==b||b+c==a||a*b==c||a*c==b||b*c==a)flag=1;else if((a&&(b%a==c||c%a==b))||(b&&(a%b==c||c%b==a))||(c&&(a%c==b||b%c==a)))flag=1; else if(a-b==c||b-a==c||a-c==b||c-a==b||c-b==a||b-c==a) flag=1; else { double a1=a,b1=b,c1=c; if((a1&&(b1/a1==c1||c1/a1==b1))||(b1&&(a1/b1==c1||c1/b1==a1))||(c1&&(a1/c1==b1||b1/c1==a1))) flag=1; }if(flag)puts("oh,lucky!");elseputs("what a pity!");}return 0;}
0 0
- HDU 2143 水
- hdu 2143
- hdu 2143
- hdu 2143
- hdu 2222 hdu 3065 hdu 2896 AC自动机水题
- hdu 1250 hdu 1130 java水大数
- HDU 2111--Saving HDU【贪心水题】
- HDU 2107 Founding of HDU(水~)
- HDU 2109 Fighting for HDU(水~)
- HDU 2143 box
- hdu 2143 box
- hdu 2143 box
- HDU 2143 BOX (水题)
- hdu 2143 box
- hdu 1056 HangOver(水)
- hdu 1070 Milk(水)
- 【水STL】hdu 4039
- hdu 1418 抱歉(水)
- 怎样练习一万小时
- 《C算法》读书笔记8:shell sort
- 用shell 批量处理任务
- 四大天王之全局服务Service,音乐播放器
- 数组知识点
- HDU 2143 水
- ACdream 1216 Beautiful People(二维上升子序列 O(nlogn))
- UIBarbuttonItem中UIBarbuttonsystemItem的用法
- CSS中的居中:完全指导
- 单例模式(Singleton Pattern)
- 想法:Github项目的持续构建、发布与部署
- [leetcode] 199.Binary Tree Right Side View
- javascript 定时器
- Material Design UI Widgets