-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathNSTEPS.cs
More file actions
31 lines (27 loc) · 766 Bytes
/
Copy pathNSTEPS.cs
File metadata and controls
31 lines (27 loc) · 766 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;
// https://www.spoj.com/problems/NSTEPS/ #ad-hoc
// Given an x and y coordinate, returns the value on the plane at that point.
public static class NSTEPS
{
public static string Solve(int x, int y)
{
if (x == y || x == y + 2)
return x % 2 == 0
? (x + y).ToString()
: (x + y - 1).ToString();
return "No Number";
}
}
public static class Program
{
private static void Main()
{
int remainingTestCases = int.Parse(Console.ReadLine());
while (remainingTestCases-- > 0)
{
int[] line = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
Console.WriteLine(
NSTEPS.Solve(line[0], line[1]));
}
}
}