Fibonacci Again
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 44697 Accepted Submission (s): 21341
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
012345
Sample Output
Nonoyesnonono
According to the laws of the predecessors 8*k+2 or 8*k+6 K for the natural number
Package Hdu;import Java.util.scanner;public class p1021 {public static void main (string[] args) { Scanner sc=new Scan NER (system.in); while (Sc.hasnext ()) { int n=sc.nextint (); if (n%8==2| | n%8==6) { System.out.println ("yes"); } else{ System.out.println ("No");}}}
ACM HDU p1021 Fibonacci Again Java Solutions for water and water law