-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArmyGame.cs
More file actions
31 lines (30 loc) · 806 Bytes
/
ArmyGame.cs
File metadata and controls
31 lines (30 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HackerrankSolution
{
public class ArmyGame
{
public static void Execute()
{
string[] rc = Console.ReadLine().Split(' ');
int.TryParse(rc[0], out int row);
int.TryParse(rc[1], out int col);
int n = 0;
while (row > 0)
{
row = row - 2;
int tempCols = col;
while (tempCols > 0)
{
tempCols = tempCols - 2;
n++;
}
}
Console.WriteLine(n);
//Console.WriteLine((row + row % 2) * (col + col % 2) / 4); //another way
}
}
}