Skip to content

Instantly share code, notes, and snippets.

@sakapon
Last active June 1, 2021 02:12
Show Gist options
  • Save sakapon/3de57bb2886ab2e84bae2cd3359b26a4 to your computer and use it in GitHub Desktop.
Save sakapon/3de57bb2886ab2e84bae2cd3359b26a4 to your computer and use it in GitHub Desktop.
競プロ典型 90 問 / Q027
using System;
using System.Collections.Generic;
class Q027
{
static void Main()
{
var n = int.Parse(Console.ReadLine());
var set = new HashSet<string>();
for (int i = 1; i <= n; i++)
{
var s = Console.ReadLine();
if (set.Add(s)) Console.WriteLine(i);
}
}
}
using System;
using System.Linq;
class Q027
{
static void Main() => Console.WriteLine(string.Join("\n", Enumerable.Range(1, int.Parse(Console.ReadLine())).GroupBy(_ => Console.ReadLine()).Select(g => g.First())));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment