HDU 1060 Leftmost Digit
题目链接:Leftmost Digit
代码如下:
#include<iostream>
#include<cmath>
using namespace std;
int n = 0, a = 0;
int main()
{
cin >> a;
while (a--) {
cin >> n;
double ans = n * (double)log10(n);
double res = ans - (__int64)ans; //一定要用_int64
cout << (int)pow(10, res) << endl;
}
return 0;
}