Hangzhou Electric 1021--fibonacci Again

Source: Internet
Author: User

Fibonacci Again

Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 43441 Accepted Submission (s): 20755


Problem Descriptionthere is another kind of Fibonacci numbers:f (0) = 7, f (1) = one, f (n) = f (n-1) + f (n-2) (n>=2).

Inputinput consists of a sequence of lines, each containing an integer n. (n < 1,000,000).

Outputprint 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

authorleojay//7 11 18 29 47 76 123 .... Die 3 after the remainder is 1 2 0 2 2 1 0 ... , write a few groups will find as long as meet n%4==2; F[n] will be divisible by 3;
1#include <stdio.h>2 intMain ()3 {4     intN;5      while(~SCANF ("%d",&N))6     {7         if(n%4==2)8printf"yes\n");9         ElseTenprintf"no\n"); One     } A     return 0; -}

Hangzhou Electric 1021--fibonacci Again

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.