## Algorithm

Problem Name: beecrowd | 3342

# Keanu

By Eliton Machado, UDESC Brazil

Timelimit: 1

Keanu was testing new chessboard models when he had the following doubt:

How many white squares and many black squares does an nxn-sized chessboard have?

3x3-sized chessboard:

5 white squares and 4 black squares

4x4-sized chessboard:

8 white squares and 8 black squares

Note that the topmost and leftmost square is always white.

## Input

The input consists of a line with a single integer n.

2

n

100

## Output

Print "a white squares and b black squares" without quotes, where a is the number of white squares and b the number of black squares.

 Input Samples Output Samples 3 5 casas brancas e 4 casas pretas

 4 8 casas brancas e 8 casas pretas

## Code Examples

### #1 Code Example with Javascript Programming

Code - Javascript Programming


const { readFileSync } = require("node:fs")
const [num] = readFileSync("/dev/stdin", "utf8")
.split("\n", 1)
.map(value => Number.parseInt(value, 10))

const whites = Math.ceil(Math.pow(num, 2) / 2)
const blacks = Math.floor(Math.pow(num, 2) / 2)

console.log("%d casas brancas e %d casas pretas", whites, blacks)

Copy The Code &

Input

cmd
3

Output

cmd
5 casas brancas e 4 casas pretas

### #2 Code Example with Javascript Programming

Code - Javascript Programming


var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
var prompt = function(texto){ return lines.shift()}

var numero=Number(prompt());

console.log(valor+' casas brancas e '+valor+' casas pretas')
}else{
console.log((valor+1)+' casas brancas e '+valor+' casas pretas')
}

Copy The Code &

Input

cmd
3

Output

cmd
5 casas brancas e 4 casas pretas

### #3 Code Example with Python Programming

Code - Python Programming


def pretobranco(n,tot):
return (tot+1)//2,((tot+1)//2)-1

n=int(input())
b,p=pretobranco(n,n*n)
print(f"{b} casas brancas e {p} casas pretas")


Copy The Code &

Input

cmd
3

Output

cmd
5 casas brancas e 4 casas pretas