- 【例8.1】人民币支付
谁会呀!!
- 2023-12-1 20:04:06 @
10多遍了,好人一生平安◑﹏◐
2 条评论
-
liguohao LV 6 @ 2023-12-2 9:21:26
谢谢
-
2023-12-1 21:05:26@
很复杂。。。#include <iostream> int main() { int amount; std::cin >> amount; int denominations[] = {100, 50, 20, 10, 5, 1}; int counts[6] = {0}; for (int i = 0; i < 6; i++) { counts[i] = amount / denominations[i]; amount %= denominations[i]; } for (int i = 0; i < 6; i++) { std::cout << counts[i] << std::endl; } }
- 1
信息
- ID
- 258
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 5
- 标签
- 递交数
- 130
- 已通过
- 48
- 上传者