Skip to content

Instantly share code, notes, and snippets.

@ryuichiueda
Last active May 5, 2018 11:32
Show Gist options
  • Save ryuichiueda/3f36e7646a09b4925ebc952af6f5c3f9 to your computer and use it in GitHub Desktop.
Save ryuichiueda/3f36e7646a09b4925ebc952af6f5c3f9 to your computer and use it in GitHub Desktop.
use std::env;
fn main(){
let args: Vec<String> = env::args().collect();
let num:i32 = args[1].parse::<i32>().unwrap();
println!("{0: >width$ }","人", width= 2 + 2*num as usize);
for i in 0..num {
let width_left = (2*num - i*2 - 1) as usize;
let width_right = (i*4 + 4) as usize;
println!("{0:>width0$} {1:>width1$}","(",")", width0 = width_left, width1 = width_right );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment