Skip to content

Instantly share code, notes, and snippets.

@gsingh93
Created January 12, 2015 05:39
Show Gist options
  • Save gsingh93/d0cf3e4de98b7aae37f6 to your computer and use it in GitHub Desktop.
Save gsingh93/d0cf3e4de98b7aae37f6 to your computer and use it in GitHub Desktop.
use std::io;
use std::str::FromStr;
use std::num::Float;
// http://codeforces.com/contest/1/problem/A
fn main() {
let l = io::stdin().read_line().unwrap();
// We need the .trim() because of the newline. Annoying
// Can't do it on one line because of lifetime error. Also annoying.
let l = l.trim();
let v: Vec<&str> = l.split(' ').collect();
let n: f32 = FromStr::from_str(v[0]).unwrap();
let m: f32 = FromStr::from_str(v[1]).unwrap();
let a: f32 = FromStr::from_str(v[2]).unwrap();
let num_rows = (n / a).ceil();
let num_cols = (m / a).ceil();
println!("{}", num_rows * num_cols);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment