找零AI (CI翻译)
Problem Statement
题目描述
AI (CI翻译)In the Kingdom of AtCoder, three kinds of coins — $1$-yen coins, $10$-yen coins, and $100$-yen coins — and $1000$-yen bills are in circulation.
在 AtCoder 王国,流通着三种硬币——$1$ 日元硬币、$10$ 日元硬币和 $100$ 日元硬币——以及 $1000$ 日元纸币。AI (CI翻译)
Takahashi made $N$ purchases, starting from a state where he had $10^{100}$ $1000$-yen bills and $0$ coins.
Takahashi 最初持有 $10^{100}$ 张 $1000$ 日元纸币和 $0$ 枚硬币,并进行了 $N$ 次购物。AI (CI翻译)
In the $i$-th purchase, he bought an item worth $A_i$ yen.
For the payment, he paid using only the minimum number of $1000$-yen bills such that the total amount paid was at least $A_i$ yen, and received the change so that the total number of coins received as change was minimized.
在第 $i$ 次购物中,他购买了一件价值 $A_i$ 日元的商品。
付款时,他只使用 $1000$ 日元纸币,并在支付总额不少于 $A_i$ 日元的前提下,使用尽可能少的纸币;收到找零时,找回的硬币总枚数也尽可能少。AI (CI翻译)
Find the number of each type of coin that Takahashi has at the point when all $N$ purchases are finished.
求全部 $N$ 次购物结束后,Takahashi 持有的每种硬币的枚数。AI (CI翻译)
Constraints
约束条件
AI (CI翻译)$1\leq N \leq 1000$$1\leq A_i \leq 10^5$- All input values are integers.
$1\leq N \leq 1000$$1\leq A_i \leq 10^5$- 所有输入值均为整数。
Input
输入格式
AI (CI翻译)The input is given from Standard Input in the following format:
输入通过标准输入给出,格式如下:AI (CI翻译)
N
A_1 \dots A_N
N
A_1 \dots A_NAI (CI翻译)
Output
输出格式
AI (CI翻译)Output the number of $1$-yen coins, $10$-yen coins, and $100$-yen coins that Takahashi has at the point when the $N$ purchases are finished, in this order, separated by spaces.
依次输出 $N$ 次购物结束后 Takahashi 持有的 $1$ 日元硬币、$10$ 日元硬币和 $100$ 日元硬币的枚数,以空格分隔。AI (CI翻译)
样例
3
1296 110 1
13 18 24
12
3141 592 65358 9 79 323 84 6264 3 38327 950 28
52 59 82
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。