Sunday, March 20, 2011

Problema 1A. Theatre Square [Codeforces]

Aqui un problema que resolví de http://www.codeforces.com
Problema 1A. Theatre Square

import java.math.BigInteger;
import java.util.Scanner;

/**
* Problema 1A - Theatre Square [http://www.codeforces.com]
*
* @author BreakDark
* @version 1.1 beta
*/
// ACEPTADO!!! xD
public class Main {
public static void main(String[] args) {
Scanner Lee; // para leer los datos de entrada
int n, m, a; // para las dimensiones n*m y a*a
BigInteger r; // para el resultado final
// AQUI INICIA EL PROGRAMA
Lee = new Scanner(System.in);
while (Lee.hasNext()) {
n = Lee.nextInt();
m = Lee.nextInt();
a = Lee.nextInt();
n = (int) Math.ceil((double) n / a);
m = (int) Math.ceil((double) m / a);
r = new BigInteger(String.valueOf(n));
r = r.multiply(new BigInteger(String.valueOf(m)));
System.out.println(r);
}
}
}

No comments: