-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStrangeGridAgain.cs
More file actions
32 lines (31 loc) · 937 Bytes
/
StrangeGridAgain.cs
File metadata and controls
32 lines (31 loc) · 937 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
32
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HackerrankSolution
{
public class StrangeGridAgain
{
public static void Execute()
{
long[] rc = Array.ConvertAll(Console.ReadLine().Split(), n => Int64.Parse(n));
long row = rc[0];
long col = rc[1];
// for(int i =0; i<row-1; i++)
// {
// if (i % 2 == 0)
// {
// selectedCellVal += 1;
// }
// else
// {
// selectedCellVal += 9;
// }
// }
long selectedRowFirsVal = (row % 2 == 0)?(((row / 2)) * 10)-9 : (long)Math.Ceiling((double)(row / 2)) * 10;
selectedRowFirsVal += 2 * (col - 1);
Console.WriteLine(selectedRowFirsVal);
}
}
}