Leftmost Digit(最左边的数)
添加链接描述
求值的最高位-----运用到对数原理
#include <bits/stdc++.h>
using namespace std;
// 科学记数法 scientific notation
// 对数logarithm / 真数antilogarithm / 底base
// 首数characteristic/ 尾数mantissa
int solve(int x){
double res = x*log10(x);
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;
}