-
Notifications
You must be signed in to change notification settings - Fork 1
/
Almost Integer Rock Garden.cs
63 lines (54 loc) · 2.28 KB
/
Almost Integer Rock Garden.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
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Solution {
static void Main(String[] args) {
string[] s = {
"1:1 1:3 1:5 2:10 3:3 3:11 1:-1 5:6 5:7 6:9 6:12 8:12",
"1:6 3:5 3:11 4:9 5:8 5:9 11:11 6:10 6:-10 7:8 9:10 10:10",
"1:2 1:10 2:5 2:10 2:-10 2:11 10:10 4:9 4:-9 6:12 7:8 10:11",
"1:8 1:12 2:7 2:8 4:8 4:11 8:11 6:11 9:9 10:12 10:-12 12:10",
"1:1 1:3 3:12 4:4 4:9 4:-9 8:9 9:4 4:11 4:12 4:-12 8:10",
"1:2 1:10 2:3 3:7 3:9 3:11 7:7 4:8 5:11 7:12 7:-12 12:7",
"1:2 1:9 1:10 1:12 3:9 4:9 6:7 6:6 8:10 9:11 11:12 11:-12",
"1:1 1:2 1:3 1:5 2:10 3:11 5:10 4:4 5:6 5:7 6:9 8:12",
"1:1 1:3 1:5 2:2 2:10 3:11 2:-2 5:6 5:7 6:9 6:12 8:12",
"1:1 1:3 1:5 2:10 3:6 3:11 3:-6 4:4 5:6 5:7 6:9 8:12",
"1:3 1:8 3:10 3:-10 4:5 6:10 4:7 7:8 7:-8 8:10 8:12 11:12",
"1:2 1:-2 1:3 1:5 2:10 3:11 5:5 4:8 5:6 5:7 6:9 8:12",
"1:6 3:5 3:11 4:9 5:8 5:9 12:12 6:10 6:-10 7:8 9:9 9:10",
"1:1 1:9 1:11 1:-11 2:12 3:8 7:11 5:8 7:10 7:-10 7:-11 8:10",
"1:1 1:3 1:9 1:11 3:5 3:10 4:10 4:8 7:9 7:12 8:12 10:12",
"1:3 1:4 1:7 1:12 4:9 4:-9 2:8 9:4 4:11 4:12 4:-12 8:10",
"1:5 1:6 1:9 2:4 2:7 3:12 9:10 4:9 4:-9 5:7 5:8 9:-10",
"1:5 1:9 2:3 2:6 2:9 3:11 6:11 4:11 5:7 7:8 7:10 10:12",
"1:1 1:3 1:5 2:3 2:10 3:11 4:6 4:4 5:6 5:7 6:12 8:12",
"1:3 1:8 2:3 2:8 2:10 2:-10 5:9 10:2 3:5 5:11 8:8 8:10"
};
string[] tokens_x = Console.ReadLine().Split(' ');
int x = Convert.ToInt32(tokens_x[0]);
int y = Convert.ToInt32(tokens_x[1]);
string org = x + ":" + y;
string ss = Math.Min(Math.Abs(x), Math.Abs(y)) + ":" + Math.Max(Math.Abs(x), Math.Abs(y));
string t1="", t2="";
for(int i=0;i<s.Length;i++)
{
string o2 = (" " + s[i] + " ").Replace(" " + org + " "," ");
string s2 = (" " + s[i] + " ").Replace(" " + ss + " "," ");
if(o2.Length<s[i].Length+2)
{
t1 = o2.Trim();
break;
}
else if(s2.Length<s[i].Length+2)
{
t2 = s2.Trim();
}
}
if(t1.Length>0)
Console.WriteLine(t1.Replace(" ","\n").Replace(":"," "));
else
Console.WriteLine(t2.Replace(" ","\n").Replace(":"," "));
}
}