HDU 1060 Leftmost Digit
2012-04-24 17:19
399 查看
题目大意是求出N^N的最高位整数。设M = N ^ N, 则对等式两边同时求lg得, M = 10^(N*lgN),由于10的整数次方的最高位恒为一,故对M的最高位不产生影响,于是对M的最高位产生影响的只有10^(N*lgN的小数部分)。由此分析过后,我们只需要求出N*lgN的小数部分a然后求10^a的整数部分即为M的最高位整数。
AC code:
View Code
AC code:
View Code
#include <iostream> #include <math.h> __int64 n; double temp; int cas; using namespace std; int main() { while(scanf("%d", &cas) != EOF) { while(cas--){ cin >> n; temp = n * log10((double)n); temp = temp - (__int64)temp; printf("%d\n", (int)pow(10.0, temp)); } } }
相关文章推荐
- hdu - 1060 - Leftmost Digit
- hdu--1060--Leftmost Digit
- HDU 1060 Leftmost Digit(数学)
- hdu 1060 Leftmost Digit
- HDU 1060 Leftmost Digit
- HDU 1060 Leftmost Digit & BIT1046 Leftmost Digit
- HDU 1060.Leftmost Digit【重点在分析】【格式【晕】】【8月31】【记录】
- HDU 1060 Leftmost Digit
- HDU 1060:Leftmost Digit【数学】
- hdu 1060 Leftmost Digit
- HDU--1060--Leftmost Digit
- hdu 1060 Leftmost Digit
- HDU 1060 Leftmost Digit
- hdu 1060 Leftmost Digit
- HDU 1060 Leftmost Digit
- HDU 1060 Leftmost Digit
- hdu 1060 Leftmost Digit
- HDU 1060 Leftmost Digit
- HDU-1060 Leftmost Digit 数论
- HDU 1060 Leftmost Digit