CF13A.Numbers

入门

通过率:0%

时间限制:1.00s

内存限制:64MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.

Now he wonders what is an average value of sum of digits of the number A written in all bases from 2 to A - 1.

Note that all computations should be done in base 10. You should find the result as an irreducible fraction, written in base 10.

小Petya非常喜欢数字。他发现,数字 123123 在十六进制(底数为 1616)下由两个数字组成:第一位是 77,第二位是 1111。因此,123123 在十六进制下的各位数字之和等于 1818。

现在他想知道:将数字 AA 分别写成从 22 到 A−1A-1 的所有进制表示时,其各位数字之和的平均值是多少?

注意:所有计算均应在十进制(底数为 1010)下进行。你应将结果表示为一个最简分数,并以十进制形式写出。

输入格式

Input contains one integer number A (3 ≤ A ≤ 1000).

输入包含一个整数 A(3 ≤ A ≤ 1000)。

输出格式

Output should contain required average value in format «X/Y», where X is the numerator and Y is the denominator.

输出应包含所需的平均值,格式为「X/Y」,其中 X 为分子,Y 为分母。

输入输出样例

  • 输入#1

    5

    输出#1

    7/3
  • 输入#2

    3

    输出#2

    2/1

说明/提示

In the first sample number 5 written in all bases from 2 to 4 looks so: 101, 12, 11. Sums of digits are 2, 3 and 2, respectively.

在第一个样例中,数字 5 在所有从 2 到 4 的进制下分别表示为:101、12、11。各位数字之和分别为 2、3 和 2。

输入解题思路,AI测评打分。不知道怎么写?

首页