码迷,mamicode.com
首页 > 其他好文 > 详细

HDU 5018 Revenge of Fibonacci

时间:2014-10-14 17:37:59      阅读:119      评论:0      收藏:0      [点我收藏+]

标签:style   io   sp   on   amp   size   as   algorithm   return   

题解:直接计算即可。

#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
    int T;
    scanf("%d",&T);
    while(T--){
        int a,b,c; bool flag=1;
        scanf("%d%d%d",&a,&b,&c);
        if(a==c||b==c){puts("Yes");continue;}
        while(b<c){
            a+=b; swap(a,b);
            if(b==c){puts("Yes");flag=0;}
        }if(flag)puts("No");
    }return 0;
}

HDU 5018 Revenge of Fibonacci

标签:style   io   sp   on   amp   size   as   algorithm   return   

原文地址:http://www.cnblogs.com/forever97/p/4024487.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!