예제 #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);
        }
예제 #2
0
파일: Whitelist.cs 프로젝트: zzhi/Algs4Net
        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);
                }
            }
        }