Created
January 12, 2015 05:39
-
-
Save gsingh93/d0cf3e4de98b7aae37f6 to your computer and use it in GitHub Desktop.
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
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