Submission #1695164
Source Code Expand
use std::io; use std::cmp; fn main() { let stdin = io::stdin(); let mut buf = String::new(); stdin .read_line(&mut buf) .unwrap(); let n: i64 = buf.trim().parse().unwrap(); buf = String::new(); stdin .read_line(&mut buf) .unwrap(); let k: i64 = buf.trim().parse().unwrap(); buf = String::new(); stdin .read_line(&mut buf) .unwrap(); let x: Vec<i64> = buf.split_whitespace() .map(|n| n.parse().unwrap()) .collect(); let mut ans = 0; for i in x { ans += cmp::min(i*2, (k-i)*2); } println!("{}", ans); }
Submission Info
Submission Time | |
---|---|
Task | B - Collecting Balls (Easy Version) |
User | nicklaw296 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 666 Byte |
Status | CE |
Compile Error
./Main.cpp:1:1: error: ‘use’ does not name a type use std::io; ^ ./Main.cpp:2:1: error: ‘use’ does not name a type use std::cmp; ^ ./Main.cpp:4:1: error: ‘fn’ does not name a type fn main() { ^