标签:amp include col nbsp std stream log mat clu
n^n 的位数 k = [lg(n^n)]+1=[n*lg(n)]+1;
最左边的数 x = n^n/10^(k-1);
取对数:lg(x) = n * lg(n) - (k-1) = (n*lg(n) - [n*lg(n)]);
最左边的数:[x] = [10^lg(x)] = [10^(n*lg(n) - [n*lg(n)])];
#include<iostream> #include<cmath> #include<cstdio> using namespace std; int main() { int n, t; scanf("%d", &t); while (t--) { scanf("%d", &n); double a = n * log10(n); printf("%d\n", (int)pow(10.0, a-(long long)a)); } }
标签:amp include col nbsp std stream log mat clu
原文地址:http://www.cnblogs.com/a863886199/p/7798313.html