PAT Newcoder数列

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		while(n>=0)
		{
			if(algrith(n)%3==0)
				System.out.println("Yes");
			else
				System.out.println("No");
			n=-1;
			n=in.nextInt();
		}
	}
	static int algrith(int n)
	{
		if(n==0)
			return 7;
		if(n==1)
			return 11;
		return algrith(n-1)+algrith(n-2);
	}
}

猜你喜欢

转载自blog.csdn.net/qq_37566910/article/details/78457158