Submission #2973207

Source Code Expand

Copy
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn solve(a:i32, b:i32, c:i32, x:i32) -> i32 {
    let mut cnt:i32 = 0;
    for i in 0..a+1 {
        for j in 0..b+1 {
            for k in 0..c+1 {
                if 500*i + 100*j + 50*k == x {
                    cnt += 1;
                }
            }
        }
    }
    cnt 
}
fn main() {
    let a = read::<i32>();
    let b = read::<i32>();
    let c = read::<i32>();
    let x = read::<i32>();
    println!("{}", solve(a, b, c, x));
}

Submission Info

Submission Time
Task ABC087B - Coins
User naoya_t
Language Rust (1.15.1)
Score 200
Code Size 625 Byte
Status
Exec Time 2 ms
Memory 4352 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample01.txt, sample02.txt, sample03.txt
All 200 / 200 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
Case Name Status Exec Time Memory
01.txt 2 ms 4352 KB
02.txt 2 ms 4352 KB
03.txt 2 ms 4352 KB
04.txt 2 ms 4352 KB
05.txt 2 ms 4352 KB
06.txt 2 ms 4352 KB
07.txt 2 ms 4352 KB
08.txt 2 ms 4352 KB
09.txt 2 ms 4352 KB
10.txt 2 ms 4352 KB
sample01.txt 2 ms 4352 KB
sample02.txt 2 ms 4352 KB
sample03.txt 2 ms 4352 KB