Sakshi Singh
1 min readDec 27, 2018

HACKERRANK SOLUTION: ARMY GAME

import java.io.*;

import java.math.*;

import java.text.*;

import java.util.*;

import java.util.regex.*;

public class Solution {

*// Complete the gameWithCells function below.

static int gameWithCells(int n, int m) {

int res = (n/2 + n%2) * (m/2 + m%2);

return res;

}

private static final Scanner scanner = new Scanner(System.in);

public static void main(String[] args) throws IOException {

BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv(“OUTPUT_PATH”)));

String[] nm = scanner.nextLine().split(“ “);

int n = Integer.parseInt(nm[0].trim());

int m = Integer.parseInt(nm[1].trim());

int result = gameWithCells(n, m);

bufferedWriter.write(String.valueOf(result));

bufferedWriter.newLine();

bufferedWriter.close();

}

}

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Sakshi Singh
Sakshi Singh

No responses yet

Write a response