思路:n^n = a*10^p.
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
int t, n;
scanf("%d", &t);
while (t--) {
double tmp, a;
scanf("%d", &n);
tmp = n*(log10((double)n));
a = tmp - floor(tmp);
printf("%d\n", (int)floor(pow(10.0,a)));
}
return 0;
}