### 标签：Circle Detect

REPORT-hihoCoder太阁最新面经算法竞赛15(AC #1 #2 #3) – 16.11.19

## REPORT-hihoCoder太阁最新面经算法竞赛15(AC #1 #2 #3) – 16.11.19

#1 Boarding Passes

```using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Boarding_Passes
{
class Program
{
static void Main(string[] args)
{

Dictionary<string, int> startcities = new Dictionary<string, int>();
Dictionary<string, int> endcities = new Dictionary<string, int>();
int startcitycount = 0, endcitycount = 0;
for (int i = 0; i < n; ++i)
{
if (!startcities.ContainsKey(inp[0]))
{
startcitycount++;
}
else
{
startcities[inp[0]]++;
}
if (!endcities.ContainsKey(inp[1]))
{
endcitycount++;
}
else
{
endcities[inp[1]]++;
}
}

foreach (var temp in startcities)
{
if (!endcities.ContainsKey(temp.Key) || endcities[temp.Key] + 1 == startcities[temp.Key])
{
Console.Write(temp.Key);
break;
}
}
Console.Write(" ");
foreach (var temp in endcities)
{
if (!startcities.ContainsKey(temp.Key) || startcities[temp.Key] + 1 == endcities[temp.Key])
{
Console.Write(temp.Key);
break;
}
}
}
}
}
```

#2 Sorting Photo Files

```using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sorting_Photo_Files
{
class Program
{
static void Main(string[] args)
{
List<string> partStr = new List<string>();
Dictionary<string, List<int>> partInt = new Dictionary<string, List<int>>();
for (int i = 0; i < N; i++)
{
var sp = split(filename);
if (!partInt.ContainsKey(sp.Key))
{
List<int> l = new List<int>();
}
else
{
}
}
foreach(var temp in partInt)
{
temp.Value.Sort();
}
partStr.Sort();
foreach(var temp in partStr)
{
foreach (var temp2 in partInt[temp])
{
Console.WriteLine("{0}{1}", temp, temp2);
}
}
}
public static KeyValuePair<string, int> split(string str)
{
KeyValuePair<string, int> retdata = new KeyValuePair<string, int>();
for (int i = 0; i < str.Length; i++)
{
if (str[i] >= '0' && str[i] <= '9')
{
string partA = str.Substring(0, i);
string partB = str.Substring(i);
retdata = new KeyValuePair<string, int>(partA, Convert.ToInt32(partB));
break;
}
}
return retdata;
}
}
}

```

#3 Circle Detect

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Circle_Detect
{
class Program
{
static void Main(string[] args)
{