2 3 4
2 2HintIn the first case, 3 * 3 * 3 = 27, so the leftmost digit is 2. In the second case, 4 * 4 * 4 * 4 = 256, so the leftmost digit is 2.
Author
Ignatius.L
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int n;int T;
cin>>T;
while(T--)
{
scanf("%d",&n);
double sum1=n*log10(double(n));
double sum2=sum1-floor(sum1);
printf("%d\n",int (pow(10,sum2)));
}
return 0;
}原文:http://blog.csdn.net/lsgqjh/article/details/44565657