Given n (n is even), determine the number of black cells in an n×n chessboard
Input Format
The only line of the input contains a single integer .
Output Format
Output the number of black cells in an chessboard.
Constraints
- is even
Sample Input 1
8
Sample Output 1
32
Explanation
There are black cells and white cells in an chessboard. So the answer is .
import java.util.*;
public class BlackCell {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
System.out.println(n*n/2);
sc.close();
}
}
Comments
Post a Comment