Created
May 4, 2016 13:11
-
-
Save yeahnoob/241b568cb7b2eee38f2624ad5a244717 to your computer and use it in GitHub Desktop.
Arrays - DS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Enter your code here | |
use std::io; | |
fn main() { | |
let mut in_line_1 = String::new(); | |
let mut in_line_2 = String::new(); | |
io::stdin().read_line(&mut in_line_1).ok().expect("Line 1 read error"); | |
io::stdin().read_line(&mut in_line_2).ok().expect("Line 2 read error"); | |
let n: usize = in_line_1.trim().parse().ok().expect("Parse Error"); | |
let mut a = vec![0i32; 0]; | |
for i in in_line_2.trim().split_whitespace().rev() { | |
a.push(i.parse().ok().expect("Parse Error")); | |
} | |
assert!(a.len() == n); | |
let ans: Vec<String> = a.iter().map(|x| x.to_string()).collect(); | |
println!("{}", ans.join(" ")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment