标签:hdu
2 3 4
2 2HintIn 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.
#include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <algorithm> using namespace std; int main() { int t; cin >> t; while (t--) { long long int num; cin >> num; double num1 = num * log10( double (num)); long long int num2 = (long long int) num1; double num3 = num1 - num2; num = (long long int) pow(10,num3); cout << num<< endl; } return 0; }
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:hdu
原文地址:http://blog.csdn.net/xiaotan1314/article/details/47045781