HDU 5018 Revenge of Fibonacci
2016-02-26 20:00
357 查看
求第三个数字是不是类Fib数列中的一项
#include<iostream> #include<cstdio> #include<set> #include<string> #include<string.h> #include<cstring> #include<vector> #include<map> #include<queue> #include<stack> #include<cctype> #include<algorithm> #include<sstream> #include<utility> #include<cmath> #define mt(a) memset(a,0,sizeof (a)) #define fl(a,b,c) fill(a,b,c) #define SWAP(a,b,t) (t=a,a=b,b=t) #define inf 1000000 using namespace std; typedef long long ll; int main() { int T; cin >> T; while (T--) { ll x, y, z,t; scanf("%lld %lld %lld", &x, &y,&z); if (x == z || y == z){ puts("Yes"); continue; } while (1) { t = x + y; if (t < z) { x = y; y = t; } else if (t == z) { puts("Yes"); break; } else if (t>z) { puts("No"); break; } } } return 0; }
相关文章推荐
- 电脑内存莫名的增加
- tableview刷新某个分区或者某行
- POJ--3169 Layout
- 【AngularJS学习笔记】02 小杂烩及学习总结
- 过河问题(牛虎过河、商人仆人过河、农夫妖怪过河、传教士野人过河)(内测第2届第2题)
- hdoj 1533 Going Home(EK增强版求最小费用最大流)
- Java对象的序列化和反序列化
- UVa 232, Crossword Answers
- 关键字static和final
- MyBatis传入参数为集合 list 数组 map写法
- leetcode79 word serach 解题报告
- 二叉树拷贝
- Java并发-类库新组件 - PriorityBlockingQueue 理解
- NGUI层级深度理解总结
- 用Jmeter进行压力测试
- Java中两种多线程的实现方式
- Steve Jobs的演讲
- pixhawk 添加超声波传感器
- Oracle backgroup processes
- jQuery对象和DOM对象 区别和相互转化