用了暴力解法,果断超时,上网一搜,哇!!!
发现了解题神法:
这有详细解释:http://acm.hdu.edu.cn/discuss/problem/post/reply.php?postid=11661&messageid=1&deep=0
想不懂的去看看吧!
直接贴代码;
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 |
#include <stdio.h>#include <math.h>int main(){ int
i,j,k,t; int
n,m; double
result; scanf("%d",&n); while(n--) { result=0; scanf("%d",&m); for(i=1;i<=m;i++) { result+=(log10((double)i)); } printf("%d\n",(int)result+1); } return
0;} |
原文:http://www.cnblogs.com/ccccnzb/p/3594915.html