Skip to content

Instantly share code, notes, and snippets.

@mortoray
Created February 9, 2018 21:44
Show Gist options
  • Select an option

  • Save mortoray/051691ab36f174548786d1b3ef076020 to your computer and use it in GitHub Desktop.

Select an option

Save mortoray/051691ab36f174548786d1b3ef076020 to your computer and use it in GitHub Desktop.
fn main() {
let mut i = "".into();
std::io::stdin().read_line(&mut i);
let mut q:Vec<i8>= i.split(" ").map(|s|s.trim().parse().unwrap()).collect();
loop {
if q[1]>q[3]{print!("S");q[3]+=1;}
let s = (q[0]-q[2]).signum();
q[2] += s;
println!("{}", ["W","","E"][(s+1) as usize]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment