AT_abc475_b.Change

入门

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

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

题目描述

In the Kingdom of AtCoder, three kinds of coins — 11-yen coins, 1010-yen coins, and 100100-yen coins — and 10001000-yen bills are in circulation.

Takahashi made NN purchases, starting from a state where he had 1010010^{100} 10001000-yen bills and 00 coins.

In the ii-th purchase, he bought an item worth AiA_i yen.
For the payment, he paid using only the minimum number of 10001000-yen bills such that the total amount paid was at least AiA_i yen, and received the change so that the total number of coins received as change was minimized.

Find the number of each type of coin that Takahashi has at the point when all NN purchases are finished.

在 AtCoder 王国,流通着三种硬币:1 日元硬币、10 日元硬币和 100 日元硬币,以及 1000 日元纸币。

高桥进行了 NN 次购物,初始状态为拥有 1010010^{100} 张 1000 日元纸币,且没有硬币。

在第 ii 次购物中,他购买了一件价值 AiA_i 日元的商品。
付款时,他仅使用最少张数的 1000 日元纸币,使得所付总额至少为 AiA_i 日元;找零时,则使得作为找零收到的硬币总枚数最少。

求在完成全部 NN 次购物后,高桥所拥有的每种硬币的数量。

输入格式

The input is given from Standard Input in the following format:

NN
A1A_1 …\dots ANA_N

输入从标准输入中按以下格式给出:

NN
A1A_1 …\dots ANA_N

输出格式

Output the number of 11-yen coins, 1010-yen coins, and 100100-yen coins that Takahashi has at the point when the NN purchases are finished, in this order, separated by spaces.

输出高桥在完成 NN 次购买后所拥有的 1 日元硬币、10 日元硬币和 100 日元硬币的数量,按此顺序以空格分隔。

输入输出样例

  • 输入#1

    3
    1296 110 1

    输出#1

    13 18 24
  • 输入#2

    12
    3141 592 65358 9 79 323 84 6264 3 38327 950 28

    输出#2

    52 59 82

说明/提示

Sample 1 Explanation:
In the first purchase, for the payment of 12961296 yen, Takahashi pays with two 10001000-yen bills, and receives seven 100100-yen coins and four 11-yen coins as change.

In the second purchase, for the payment of 110110 yen, he pays with one 10001000-yen bill, and receives eight 100100-yen coins and nine 1010-yen coins as change.

In the third purchase, for the payment of 11 yen, he pays with one 10001000-yen bill, and receives nine 100100-yen coins, nine 1010-yen coins, and nine 11-yen coins as change.

At the point when the three purchases are finished, he has 1313 11-yen coins, 1818 1010-yen coins, and 2424 100100-yen coins.

Constraints

  • 1≤N≤10001\leq N \leq 1000
  • 1≤Ai≤1051\leq A_i \leq 10^5
  • All input values are integers.

样例 1 解释:
第一次购物中,对于 12961296 日元的付款,高桥使用了两张 10001000 日元纸币支付,并收到七枚 100100 日元硬币和四枚 11 日元硬币作为找零。

第二次购物中,对于 110110 日元的付款,他使用了一张 10001000 日元纸币支付,并收到八枚 100100 日元硬币和九枚 1010 日元硬币作为找零。

第三次购物中,对于 11 日元的付款,他使用了一张 10001000 日元纸币支付,并收到九枚 100100 日元硬币、九枚 1010 日元硬币和九枚 11 日元硬币作为找零。

当完成这三次购物后,他共持有 1313 枚 11 日元硬币、1818 枚 1010 日元硬币和 2424 枚 100100 日元硬币。

限制条件

  • 1≤N≤10001\leq N \leq 1000
  • 1≤Ai≤1051\leq A_i \leq 10^5
  • 所有输入值均为整数。

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

首页