題目描述
現給你一個正整數N,請問N^N的最左邊的數字是什麼?
輸入格式
輸入包含多組測試數據。每組輸入一個正整數N(N<=1000000)。
輸出
對於每組輸入,輸出N^N的最左邊的數字。
樣例輸入
3
4
樣例輸出
2
2
#include<stdio.h>
#include<math.h>
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
printf("%d\n",(int)pow(10,n*log10(n)-(int)(n*log10(n))));
return 0;
}