HDU1021

来源:互联网 发布:金蝶软件服务商 编辑:程序博客网 时间:2024/06/15 05:43
 本文章仅用于笔记。部分知识点来源于网络,授权请联系作者(1091879478@qq.com)。 


 题目 

Fibonacci Again

   HDU-1021


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
012345
Sample Output
nonoyesnonono






 代码 



 import java.util.Scanner;public class h1021{public static void main(String[] args){Scanner cin=new Scanner(System.in); while (cin.hasNextInt()){ int n=cin.nextInt();n=n+2;if ( n%4==0)System.out.println("yes");else  System.out.println("no");}}} 




 注释 


//规律 当n=3开始,后面的数值对3取余每四次一个循环

原创粉丝点击