中石油5112: Equal Numbers(贪婪心仿造)

作者: locoy 分类: hg0088如何开户 发布时间: 2019-09-11 16:04

  3 Sec512 MB

  416

  [提提交][样儿子][讨论版][命题人:admin]You are given a list of n integers a1,...,an. You can perform the following operation: choose some ai and multiply it by any positive integer.

  Your task is to compute the minimum number of different integers that could be on the list after k operations for all 0≤k≤n.

  The first line of the input contains single integer n (1≤n≤3≤105). The second line of the input contains n integers ai (1≤ai≤106).Output a single line that contains n + 1 integers. The i-th integer should be the minimum possible number of different integers in the list after i-1 operations.

  【题意】

  体即兴看不懂俄式英语。(题目果然用some ai, 然后前面用it到来代指,我搞不懂出产题人从哪个国度学的英语,中国人看不懂)

  拥有n个数,拥有壹种操干:你却以选择就中恣意壹个数ai ,然后你却以把他迨上壹个正整顿数。

  讯问:当却以实行k次操干时,你却以违反掉落的最小的 “不一数的个数”

  【剖析】

  假设壹个数的倍数在前言列中出产即兴了,那把他成了英公此雕刻个倍数,最无时间增添以不一数量。

  不然,不得不把它成了英公他们的最小公倍数,容许不变(相当于迨1)

  把每个数及出产即兴次数统计,按出产即兴次数排前言,优先变次数微少的。

  【代码】

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!