N^N吓死你
| Time Limit: | 1000MS | Memory Limit: | 65536KB |
|---|---|---|---|
| Total Submissions: | 66 | Accepted: | 35 |
Description:
给你一个N,你应该输出N^N最左边一位。
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:
对于每组测试数据,你应该输出N^N最左边一位。
Sample Input:
234
Sample Output:
22
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;
}
\
\