B. Progress Bar

Codeforces
IDCF71B
Time1000ms
Memory256MB
Difficulty
implementationmath
English · Original
Chinese · Translation
Formal · Original
A progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar. A bar is represented as _n_ squares, located in line. To add clarity, let's number them with positive integers from 1 to _n_ from the left to the right. Each square has saturation (_a__i_ for the _i_\-th square), which is measured by an integer from 0 to _k_. When the bar for some _i_ (1 ≤ _i_ ≤ _n_) is displayed, squares 1, 2, ... , _i_ - 1 has the saturation _k_, squares _i_ + 1, _i_ + 2, ... , _n_ has the saturation 0, and the saturation of the square _i_ can have any value from 0 to _k_. So some first squares of the progress bar always have the saturation _k_. Some last squares always have the saturation 0. And there is no more than one square that has the saturation different from 0 and _k_. The degree of the process's completion is measured in percents. Let the process be _t_% completed. Then the following inequation is fulfilled: An example of such a bar can be seen on the picture. <center>![image](https://espresso.codeforces.com/c5c3951d407b9d376bf210a8c1a4010bfedcaf36.png)</center>For the given _n_, _k_, _t_ determine the measures of saturation for all the squares _a__i_ of the progress bar. ## Input We are given 3 space-separated integers _n_, _k_, _t_ (1 ≤ _n_, _k_ ≤ 100, 0 ≤ _t_ ≤ 100). ## Output Print _n_ numbers. The _i_\-th of them should be equal to _a__i_. [samples]
[{"iden":"statement","content":"进度条是图形界面中用于显示当前进程完成进度的元素。让我们来看一下这种进度条的一种形式。\n\n该进度条由 #cf_span[n] 个方块组成,排成一行。为了清晰起见,我们从左到右用正整数 #cf_span[1] 到 #cf_span[n] 对它们进行编号。每个方块具有饱和度(第 #cf_span[i] 个方块的饱和度为 #cf_span[ai]),其值为一个从 #cf_span[0] 到 #cf_span[k] 的整数。当进度条显示到某个位置 #cf_span[i](#cf_span[1 ≤ i ≤ n])时,方块 #cf_span[1, 2, ... , i - 1] 的饱和度为 #cf_span[k],方块 #cf_span[i + 1, i + 2, ... , n] 的饱和度为 #cf_span[0],而方块 #cf_span[i] 的饱和度可以是 #cf_span[0] 到 #cf_span[k] 之间的任意值。\n\n因此,进度条最前面的一些方块饱和度始终为 #cf_span[k],最后面的一些方块饱和度始终为 #cf_span[0],且最多只有一个方块的饱和度既不是 #cf_span[0] 也不是 #cf_span[k]。\n\n进程的完成程度以百分比衡量。设进程已完成 #cf_span[t]%,则以下不等式成立:\n\n此类进度条的一个示例见下图。\n\n给定 #cf_span[n]、#cf_span[k]、#cf_span[t],请确定进度条所有方块 #cf_span[ai] 的饱和度。\n\n我们给出三个空格分隔的整数 #cf_span[n]、#cf_span[k]、#cf_span[t](#cf_span[1 ≤ n, k ≤ 100],#cf_span[0 ≤ t ≤ 100])。\n\n请输出 #cf_span[n] 个数字,第 #cf_span[i] 个数字应等于 #cf_span[ai]。"},{"iden":"input","content":"我们给出三个空格分隔的整数 #cf_span[n]、#cf_span[k]、#cf_span[t](#cf_span[1 ≤ n, k ≤ 100],#cf_span[0 ≤ t ≤ 100])。"},{"iden":"output","content":"请输出 #cf_span[n] 个数字,第 #cf_span[i] 个数字应等于 #cf_span[ai]。"},{"iden":"examples","content":"输入10 10 54输出10 10 10 10 10 4 0 0 0 0 输入11 13 37输出13 13 13 13 0 0 0 0 0 0 0 "}]}
**Definitions** Let $ n, k, t \in \mathbb{Z} $ be given integers, where: - $ n $: number of squares in the progress bar, - $ k $: maximum saturation value, - $ t $: completion percentage ($ 0 \leq t \leq 100 $). Let $ A = (a_1, a_2, \dots, a_n) $ be the sequence of saturation values for the $ n $ squares, where each $ a_i \in \{0, 1, \dots, k\} $. **Constraints** 1. $ 1 \leq n \leq 100 $ 2. $ 1 \leq k \leq 100 $ 3. $ 0 \leq t \leq 100 $ **Objective** Compute $ A = (a_1, \dots, a_n) $ such that: - There exists an index $ i \in \{1, \dots, n\} $ where: - $ a_j = k $ for all $ j < i $, - $ a_j = 0 $ for all $ j > i $, - $ a_i \in \{0, 1, \dots, k\} $ (at most one such $ i $ with intermediate value). The index $ i $ and value $ a_i $ are determined by the percentage $ t $: Let $ p = \frac{t}{100} \cdot n $ be the fractional progress position. Define: - $ i = \lfloor p \rfloor + 1 $, - $ \text{frac} = p - \lfloor p \rfloor $, - $ a_i = \lfloor k \cdot \text{frac} + 0.5 \rfloor $ (rounded to nearest integer). Then: $$ a_j = \begin{cases} k & \text{if } j < i, \\ \lfloor k \cdot (p - \lfloor p \rfloor) + 0.5 \rfloor & \text{if } j = i, \\ 0 & \text{if } j > i. \end{cases} $$ If $ p \geq n $, then $ i = n $ and $ a_n = k $, with all $ a_j = k $. If $ p < 1 $, then $ i = 1 $ and $ a_1 = \lfloor k \cdot p + 0.5 \rfloor $, with $ a_j = 0 $ for $ j > 1 $.
Samples
Input #1
10 10 54
Output #1
10 10 10 10 10 4 0 0 0 0
Input #2
11 13 37
Output #2
13 13 13 13 0 0 0 0 0 0 0
API Response (JSON)
{
  "problem": {
    "name": "B. Progress Bar",
    "description": {
      "content": "A progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar. A bar i",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF71B"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "A progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar.\n\nA bar i...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "[{\"iden\":\"statement\",\"content\":\"进度条是图形界面中用于显示当前进程完成进度的元素。让我们来看一下这种进度条的一种形式。\\n\\n该进度条由 #cf_span[n] 个方块组成,排成一行。为了清晰起见,我们从左到右用正整数 #cf_span[1] 到 #cf_span[n] 对它们进行编号。每个方块具有饱和度(第 #cf_span[i] 个方块的饱和度为 #cf_spa...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n, k, t \\in \\mathbb{Z} $ be given integers, where:  \n- $ n $: number of squares in the progress bar,  \n- $ k $: maximum saturation value,  \n- $ t $: completion percentage ($ 0 ...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments