P28205 [洛谷] Maximum Division Product
提高
题目描述

Problem Description

Let $N$ be a positive integer and let $N$ be split into $k$ equal parts, $r = N/k$, so that $N = r + r + ... + r$.

Let $P$ be the product of these parts, $P = r \times r \times ... \times r = r^k$.

For example, if $11$ is split into five equal parts, $11 = 2.2 + 2.2 + 2.2 + 2.2 + 2.2$, then $P = 2.2^5 = 51.53632$.

Let $M(N)$ be the maximum value of $P$ for a given value of $N$.

It turns out that the maximum for $N = 11$ is found by splitting eleven into four equal parts which leads to $P_{max} = (11/4)^4$; that is, $M(11) = 14641/256 = 57.19140625$, which is a terminating decimal.

However, for $N = 8$ the maximum is achieved by splitting it into three equal parts, so $M(8) = 512/27$, which is a non-terminating decimal.

Let $D(N) = N$ if $M(N)$ is a non-terminating decimal and $D(N) = -N$ if $M(N)$ is a terminating decimal.

Given a positive integer $a$ where $5 \leq a \leq 32767$, find the value of $D(5) + D(6) + ... + D(a)$.

Input Format

The input file contains a single line with a positive integer $a$ where $5 \leq a \leq 32767$.

Output Format

The output file contains a single line with the value of $D(5) + D(6) + ... + D(a)$.

Sample Input and Output

Sample Input #1

10

Sample Output #1

-15

Sample Input #2

100

Sample Output #2

2438
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
10
样例输出
-15