顯示包含「Inclusion-Exclusion Principle」標籤的文章。顯示所有文章
顯示包含「Inclusion-Exclusion Principle」標籤的文章。顯示所有文章

2010年7月13日星期二

HDU 3208 Integer's Power

在 HDU OJ 看 problem title 隨便挑的一題...
AC rate 判定這題值得一做



題意:


對於正整數 x = be,其中 be 為正整數
定義 x (≥ 2) 的 integer powere最大可能
(81 的 integer power 是 4,不是 2)

給定正整數 2 ≤ AB ≤ 1018
求 [A, B] 區間內所有正整數的 integer power 的總和



分析:


稍為簡化問題:
令 f(Y) := [1, Y] 區間所有正整數的 integer power 總和
則答案 = f(B) - f(A - 1)