CF58B.Coins

普及-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

In Berland a money reform is being prepared. New coins are being introduced. After long economic calculations was decided that the most expensive coin should possess the denomination of exactly n Berland dollars. Also the following restriction has been introduced for comfort: the denomination of each coin should be divisible by the denomination of any cheaper coin. It is known that among all the possible variants the variant with the largest number of new coins will be chosen. Find this variant. Print in the order of decreasing of the coins' denominations.

在贝尔兰,一场货币改革正在筹备中。新型硬币即将发行。经过长期的经济计算,最终决定最贵的硬币面额恰好为 nn 贝尔兰元。此外,为便于使用,还引入了如下限制:每枚硬币的面额必须能被任何更便宜的硬币的面额整除。已知在所有可能的方案中,将选择硬币种类数最多的方案。请找出该方案,并按面额从高到低的顺序输出各硬币的面额。

输入格式

The first and only line contains an integer n (1 ≤ n ≤ 106) which represents the denomination of the most expensive coin.

第一行且唯一一行包含一个整数 nn(1 ≤ n ≤ 1061 \leq n \leq 10^6),表示最贵硬币的面值。

输出格式

Print the denominations of all the coins in the order of decreasing. The number of coins must be the largest possible (with the given denomination n of the most expensive coin). Also, the denomination of every coin must be divisible by the denomination of any cheaper coin. Naturally, the denominations of all the coins should be different. If there are several solutins to that problem, print any of them.

按面值从大到小的顺序输出所有硬币的面额。硬币的数量必须尽可能多(给定最贵硬币的面额为 nn)。此外,每枚硬币的面额必须能被任意更便宜硬币的面额整除。显然,所有硬币的面额必须互不相同。若该问题存在多种解法,输出其中任意一种即可。

输入输出样例

  • 输入#1

    10

    输出#1

    10 5 1
  • 输入#2

    4

    输出#2

    4 2 1
  • 输入#3

    3

    输出#3

    3 1

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

首页