Leftmost Digit
http://acm.hdu.edu.cn/showproblem.php?pid=1060
#include<cstdio>
#include<cmath>
using namespace std;
int solve(int n)
{
double res = n * log10(n);
return pow(10, res - floor(res));
}
int main()
{
int n,t;
scanf("%d", &t);
while (t--) {
scanf("%d", &n);
printf("%d\n", solve(n));
}
return 0;
}