提出 #48659040
ソースコード 拡げる
// -*- coding:utf-8-unix -*-
use proconio::input;
fn main() {
input! {
a: usize,
b: usize,
c: usize,
x: usize,
}
let target = x / 50;
let coins = vec![(10, a), (2, b), (1, c)];
let result = coins
.iter()
.map(|(unit, n)| (0..=*n).map(|i| i * unit).collect::<Vec<usize>>())
.fold(vec![0], |acc, v| {
acc.iter()
.flat_map(|&i| v.iter().map(move |j| j + i))
.collect::<Vec<usize>>()
})
.iter()
.filter(|&&i| i == target)
.count();
println!("{}", result);
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - Coins |
| ユーザ | homura10059 |
| 言語 | Rust (rustc 1.70.0) |
| 得点 | 200 |
| コード長 | 640 Byte |
| 結果 | AC |
| 実行時間 | 1 ms |
| メモリ | 3120 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 200 / 200 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample01.txt, sample02.txt, sample03.txt |
| All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, sample01.txt, sample02.txt, sample03.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 01.txt | AC | 1 ms | 2388 KiB |
| 02.txt | AC | 1 ms | 1948 KiB |
| 03.txt | AC | 1 ms | 1876 KiB |
| 04.txt | AC | 1 ms | 3120 KiB |
| 05.txt | AC | 1 ms | 1956 KiB |
| 06.txt | AC | 1 ms | 2228 KiB |
| 07.txt | AC | 1 ms | 3112 KiB |
| 08.txt | AC | 1 ms | 2116 KiB |
| 09.txt | AC | 1 ms | 2016 KiB |
| 10.txt | AC | 1 ms | 2020 KiB |
| sample01.txt | AC | 1 ms | 2096 KiB |
| sample02.txt | AC | 1 ms | 2092 KiB |
| sample03.txt | AC | 1 ms | 2464 KiB |