zoukankan      html  css  js  c++  java
  • hdu 1021 Fibonacci Again(找规律)

    http://acm.hdu.edu.cn/showproblem.php?pid=1021

    Fibonacci Again

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 29201    Accepted Submission(s): 14148

    Problem Description
    There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2).
     
    Input
    Input consists of a sequence of lines, each containing an integer n. (n < 1,000,000).
     
    Output
    Print the word "yes" if 3 divide evenly into F(n).
    Print the word "no" if not.
     
    Sample Input
    0 1 2 3 4 5
     
    Sample Output
    no no yes no no no
     
    Author
    Leojay
     
    思路:
    题意:以7 11 开始的类似斐波拉契数列中能被3整除的输出yes  否则输出no
    不解释 怒找一规律
     
    上代码:
     1 #include<iostream>
     2 #include<stdio.h>
     3 #include<string.h>
     4 
     5 using namespace std;
     6 
     7 int main()
     8 {
     9     int n;
    10     while(~scanf("%d",&n))
    11     {
    12         if((n-2)%4==0)  puts("yes");
    13         else puts("no");
    14     }
    15     return 0;
    16 }
     
  • 相关阅读:
    GDOI模拟赛Round 1
    Codeforces 241B
    Codeforces 325E
    Codeforces 235E
    Codeforces 293B
    Codeforces 263E
    快速傅里叶变换FFT
    后缀自动机
    NOI2011 Day2
    NOI2014 Day2
  • 原文地址:https://www.cnblogs.com/crazyapple/p/3221774.html
Copyright © 2011-2022 走看看