300927: CF177B1. Rectangular Game
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:1
Solved:0
Description
Rectangular Game
题意翻译
有 $n$ 个点, 每次操作都将剩余点摆成一个矩形并只保留最后一行,求每次操作剩下点数和的最大值题目描述
The Smart Beaver from ABBYY decided to have a day off. But doing nothing the whole day turned out to be too boring, and he decided to play a game with pebbles. Initially, the Beaver has $ n $ pebbles. He arranges them in $ a $ equal rows, each row has $ b $ pebbles ( $ a>1 $ ). Note that the Beaver must use all the pebbles he has, i. e. $ n=a·b $ . ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF177B1/72b3400d0a6aa691e5c49fe273a750815ff16b58.png) 10 pebbles are arranged in two rows, each row has 5 pebbles Once the Smart Beaver has arranged the pebbles, he takes back any of the resulting rows (that is, $ b $ pebbles) and discards all other pebbles. Then he arranges all his pebbles again (possibly choosing other values of $ a $ and $ b $ ) and takes back one row, and so on. The game continues until at some point the Beaver ends up with exactly one pebble. The game process can be represented as a finite sequence of integers $ c_{1},...,c_{k} $ , where: - $ c_{1}=n $ - $ c_{i+1} $ is the number of pebbles that the Beaver ends up with after the $ i $ -th move, that is, the number of pebbles in a row after some arrangement of $ c_{i} $ pebbles ( $ 1<=i<k $ ). Note that $ c_{i}>c_{i+1} $ . - $ c_{k}=1 $ The result of the game is the sum of numbers $ c_{i} $ . You are given $ n $ . Find the maximum possible result of the game.输入输出格式
输入格式
The single line of the input contains a single integer $ n $ — the initial number of pebbles the Smart Beaver has. The input limitations for getting 30 points are: - $ 2<=n<=50 $ The input limitations for getting 100 points are: - $ 2<=n<=10^{9} $
输出格式
Print a single number — the maximum possible result of the game.
输入输出样例
输入样例 #1
10
输出样例 #1
16
输入样例 #2
8
输出样例 #2
15