和上一题一样的,只是最右边的数。找规律,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]); } } }
时间: 2024-11-16 02:46:41