标签:style blog http java color os
数学公式 log(10) n! = log 1 + log 2 + …… + log n 就能求出位数了,取下限
表示第一次用JAVA,勿喷~
1 import java.util.Scanner; 2 3 4 public class Main { 5 public static void main(String[] args) 6 { 7 Scanner sc = new Scanner (System.in); 8 int test; test = sc.nextInt(); 9 int n; 10 for(int rd = 0; rd != test; ++rd) 11 { 12 n = sc.nextInt(); 13 double res = 1; 14 for(int i = 1; i <= n; ++i) 15 res += Math.log10(i); 16 int tmp = (int) Math.floor(res); 17 18 System.out.println("" + tmp); 19 20 } 21 sc.close(); 22 } 23 }
HDU ACMSteps 2.3.2 BigNumber,布布扣,bubuko.com
标签:style blog http java color os
原文地址:http://www.cnblogs.com/overcode/p/3815225.html