Ejemplo n.º 1
0
        public static void MainTest(string[] args)
        {
            TextInput StdIn = new TextInput(args[0]);

            int[] a = StdIn.ReadAllInts();
            a = OrderHelper.RemoveDuplicates(a);
            int cnt = ThreeSumFast.Count(a);

            Console.WriteLine(cnt);
        }
Ejemplo n.º 2
0
        public static void MainTest(string[] args)
        {
            TextInput input = new TextInput(args[0]);

            int[] white = input.ReadAllInts();
            input.Close();

            // remove duplicates, if any, so the ctor below will not throw an exception
            white = OrderHelper.RemoveDuplicates(white);
            StaticSETofInts set = new StaticSETofInts(white);

            TextInput StdIn = new TextInput();

            // Read key, print if not in whitelist.
            while (!StdIn.IsEmpty)
            {
                int key = StdIn.ReadInt();
                if (!set.Contains(key))
                {
                    Console.WriteLine(key);
                }
            }
        }