/
11908.rs
47 lines (37 loc) · 974 Bytes
/
11908.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* 11908. 카드
*
* 작성자: xCrypt0r
* 언어: Rust 2018
* 사용 메모리: 13,028 KB
* 소요 시간: 4 ms
* 해결 날짜: 2020년 10월 3일
*/
macro_rules! get_line {
( $( $t: ty ),+ ) => {
{
let mut line = String::new();
std::io::stdin().read_line(&mut line).unwrap();
let mut iter = line.split_whitespace();
( $( iter.next().unwrap().parse::<$t>().unwrap() ),+ )
}
}
}
macro_rules! get_list {
( $t: ty ) => {
{
let mut line = String::new();
std::io::stdin().read_line(&mut line).unwrap();
let list: Vec<$t> = line
.split_whitespace()
.map(|s| s.parse::<$t>().unwrap())
.collect();
list
}
}
}
fn main() {
let _ = get_line!(i32);
let cards = get_list!(i32);
println!("{}", cards.iter().sum::<i32>() - cards.iter().max().unwrap());
}