标签:
import java.util.Scanner; import java.math.BigInteger; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); while(sc.hasNext()){ int n=sc.nextInt(); BigInteger s = BigInteger.ONE; for(int i=1;i<=n;i++){ s=s.multiply(BigInteger.valueOf(i)); } String s1=""+s; for(int i=s1.length()-1;i>=0;i--){ if(s1.charAt(i)!=‘0‘){ System.out.println(s1.charAt(i)); break; } } } } }
标签:
原文地址:http://www.cnblogs.com/watchfree/p/5346968.html