Update solution for 약수 w/ id 19726222
Time: 4ms MemUsage: 13032KB
This commit is contained in:
27
baekjoon/약수/solution_19726222.rs
Normal file
27
baekjoon/약수/solution_19726222.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
use std::io::{self, BufRead};
|
||||
|
||||
fn main(){
|
||||
let stdin = io::stdin();
|
||||
let mut lock_in = stdin.lock();
|
||||
|
||||
let mut n = String::new();
|
||||
lock_in.read_line(&mut n).expect("Failed to read line");
|
||||
let _n = n.parse::<usize>();
|
||||
|
||||
let mut line = String::new();
|
||||
lock_in.read_line(&mut line).expect("Failed to read line");
|
||||
let line : Vec<usize> = line.trim().split_whitespace()
|
||||
.map(|x| x.parse::<usize>().expect("Not an integer"))
|
||||
.collect();
|
||||
|
||||
let (mut min, mut max) = (1_000_000, 1);
|
||||
for &x in line.iter(){
|
||||
if x < min{
|
||||
min = x;
|
||||
}
|
||||
if x > max{
|
||||
max = x;
|
||||
}
|
||||
}
|
||||
println!("{}", min * max);
|
||||
}
|
||||
Reference in New Issue
Block a user