Description
Input
Each test case contains a single positive integer N(1<=N<=1,000,000,000).
Output
Sample Input
Sample Output
Hint
In 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.
題目大意:
給你一個 n ,然後求出 n ^ n 的最高位的數值是多少。
附上代碼:
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
double n;
scanf("%lfd",&n);
double a = n * log10(n);
long long int b = (long long int)a;
double c = a - b;
long long int ans = (long long int)pow(10,c);
printf("%I64d\n",ans);
}
return 0;
}