原帖由 局外人 于 2007-5-2 08:33 發(fā)表
要列出全部解嗎?沒想到比窮搜更好的辦法。
12 就是一個解
12^1000000 ~ 1.762169275684230318197167758 E1079181
4 是最小解
4^1000000 ~ 9.802299377069567415894016537 E602059
原帖由 GKL 于 2007-5-2 05:18 發(fā)表
需要找出所有的解嗎?
窮舉估計得很長時間。。
原帖由 局外人 于 2007-5-2 18:12 發(fā)表
n^1000000 如果有 d 個十進(jìn)制位, 則 n^1000000/10^(d-4) 的整數(shù)部分就是前 4 位
用 log 和 pow 計算 d 和上面的這個值就可以了.
原帖由 emacsnw 于 2007-5-3 13:36 發(fā)表
不錯不錯
原題的答案是1000001,它的1000000次方的前4位是2718,用數(shù)學(xué)方法就可以推出來的,呵呵。
不過樓上的代碼求解很漂亮,贊一個。
原帖由 局外人 于 5/3/07 10:08 發(fā)表
用 log 和 pow
[code]
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int
main (int argc, char **argv)
{
unsigned long digits;
double N, M, r;
unsign ...
原帖由 bGFuZ3Vl 于 5/3/07 13:41 發(fā)表
You mean it could be done through mathematical induction. Would you like to show how?
原帖由 bGFuZ3Vl 于 2007-5-2 21:41 發(fā)表
You mean it could be done through mathematical induction. Would you like to show how?
原帖由 ArXoR 于 2007-5-2 22:13 發(fā)表
就差誤差分析了, 把判定問題交給浮點(diǎn)數(shù)總是不怎么讓人放心
原帖由 emacsnw 于 2007-5-3 14:30 發(fā)表
我們知道自然對數(shù)的底數(shù) e = lim_{n\to \infty}(1+1/n)^n
令 n = 1000000,那么1000001^1000000 = (n(1+1/n))^n=n^n(1+1/n)^n
n^n就是(10^6)^1000000,貢獻(xiàn)了后面一大把0,因此頭四位是由(1+1/n)^n決定的 ...
歡迎光臨 Chinaunix (http://www.72891.cn/) | Powered by Discuz! X3.2 |