FAFU OJ N^N吓死你
原创
©著作权归作者所有:来自51CTO博客作者兔云程序的原创作品,请联系作者获取转载授权,否则将追究法律责任
N^N吓死你
Time Limit: |
1000MS |
Memory Limit: |
65536KB |
Total Submissions: |
66 |
Accepted: |
35 |
Share
Description:
Input:
The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow. Each test case contains a single positive integer N(1<=N<=1,000,000,000).
Output:
Sample Input:
Sample Output:
Hint:
对于3 * 3 * 3 = 27,最左边一位是2. 对于4 * 4 * 4 * 4 = 256, 最左边一位是2.
Source:
#include<stdio.h>
#include <math.h>
int main()
{
double s;
int n,i,T;
//freopen("data.in","r",stdin);
//freopen("data.out","w",stdout);
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
s=n*log10(n);
s=s-(__int64)s;
s=pow(10,s);
printf("%d\n",(int)s);
}
return 0;
}