A7771 | Numbers
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
Input contains one integer number $A$ ( $3<=A<=1000$ ).
输出格式
Output should contain required average value in format «X/Y», where X is the numerator and Y is the denominator.
输入输出样例
输入 #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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted