数学_同取对数(HDU_1060)
生活随笔
收集整理的這篇文章主要介紹了
数学_同取对数(HDU_1060)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
m = n^n ?==> ?lg(m) = lg(n^n)??==> ?lg(m) = n*lg(n)??==> ?m = 10^(n*lg(n))
對于 10^N = 10^123.456 = 10^(123+0.456) = 10^123 * 10^0.0.456
10^123 的最高位為 '1',即 10^N 的最高位取決于?n*lg(n) 的小數(shù)部位
#include <stdio.h> #include <string.h> #include <math.h>int main(int argc, char* argv[]) {#ifdef __MYLOCALfreopen("in.txt","r",stdin);#endifint t;scanf("%d",&t);while(t--){int n;scanf("%d",&n);int a = (int)pow(10.0,n*log10(n*1.0) - (__int64)(n*log10(n*1.0)));printf("%d\n",a);}return 0; }?
轉(zhuǎn)載于:https://www.cnblogs.com/lk1993/p/3244482.html
總結(jié)
以上是生活随笔為你收集整理的数学_同取对数(HDU_1060)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Vim的6种模式
- 下一篇: 白盒测试哪种测试效果好_白盒测试与黑盒测