-
Notifications
You must be signed in to change notification settings - Fork 54
/
CSharp.cs
50 lines (42 loc) · 1.42 KB
/
CSharp.cs
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/****************************************/
/* */
/* CodinGame.com Solutions by pathosDev */
/* */
/* Puzzle: Guessing n Cheating */
/* Difficulty: Easy */
/* Date solved: 05.03.2019 */
/* */
/****************************************/
using System;
public class Solution
{
public static void Main()
{
int R = int.Parse(Console.ReadLine());
int start = 1, end = 100;
for (int i = 0; i < R; i++)
{
//Read conversations.
string[] guess = Console.ReadLine().Split();
int bob = int.Parse(guess[0]);
string alice = guess[1] + " " + guess[2];
//Adjust range.
if (alice == "too low")
{
start = Math.Max(start, bob + 1);
}
else if (alice == "too high")
{
end = Math.Min(end, bob - 1);
}
//Check if alice cheated.
if (end < start || alice == "right on" && !(start <= bob && bob <= end))
{
Console.WriteLine("Alice cheated in round {0}", i + 1);
Environment.Exit(0);
}
}
//Alice didn't cheat.
Console.WriteLine("No evidence of cheating");
}
}