hdu 1061 Rightmost Digit

 

    和上一题一样的,只是最右边的数。找规律,20个一循环

 

import java.util.Scanner;

public class Main
{
	final static int a[]={0,1,4,7,6,5,6,3,6,9,0,1,6,3,6,5,6,7,4,9};
	static Scanner cin=new Scanner(System.in);
	static int n,T;
	
	public static void main(String[] args) 
	{
		T=cin.nextInt();
		while(T--!=0)
		{
		   n=cin.nextInt();
		   System.out.println(a[n%20]);
		}
		
	}
}


 

上一篇:hdu 1055 Color a Tree


下一篇:云计算,大数据,人工智能能否拯救没落的IBM?