Skip to content

Instantly share code, notes, and snippets.

@sakapon
Created December 15, 2019 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sakapon/a85348186a8f49dc01980b83b4731d93 to your computer and use it in GitHub Desktop.
Save sakapon/a85348186a8f49dc01980b83b4731d93 to your computer and use it in GitHub Desktop.
sumitrust2019 D - Lucky PIN (1)
using System;
using System.Linq;
class D
{
static void Main()
{
Console.ReadLine();
var s = Console.ReadLine();
int i;
Console.WriteLine(Enumerable.Range(0, 1000).Select(x => $"{x:D3}").Count(p => (i = s.IndexOf(p[0])) > -1 && (i = s.IndexOf(p[1], i + 1)) > -1 && s.IndexOf(p[2], i + 1) > -1));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment