예제 #1
0
        public static void Run()
        {
            string[] tokens_m = Console.ReadLine().Split(' ');
            int      m        = Convert.ToInt32(tokens_m[0]);
            int      n        = Convert.ToInt32(tokens_m[1]);

            string[] magazine = CharIntValues.ReadLine(300000).Split(' ');
            string[] ransom   = CharIntValues.ReadLine(300000).Split(' ');

            List <string> mag = magazine.ToList <string>();

            mag.Sort((str, str2) => str.CompareTo(str2));

            string available = "Yes";

            for (int i = 0; i < ransom.Length; i++)
            {
                if (!Remove(ransom[i], mag))
                {
                    available = "No";
                    break;
                }
            }

            Console.WriteLine(available);

            Console.ReadKey();
        }
예제 #2
0
        public static void Rotate2()
        {
            string[] tokens_n = Console.ReadLine().Split(' ');
            int      n        = Convert.ToInt32(tokens_n[0]);
            int      k        = Convert.ToInt32(tokens_n[1]);
            int      q        = Convert.ToInt32(tokens_n[2]);

            string[] a_temp = CharIntValues.ReadLine().Split(' ');
            int[]    a      = Array.ConvertAll(a_temp, Int32.Parse);

            int[] vals = new int[n];
            int   pos;

            for (int j = 0; j < n; j++)
            {
                pos       = (j + k) % n;
                vals[pos] = a[j];
            }
            a = vals;

            int[] arr = new int[q];
            for (int a0 = 0; a0 < q; a0++)
            {
                int m = Convert.ToInt32(Console.ReadLine());
                arr[a0] = m;
            }

            Console.WriteLine("\r\nANSWERS");
            for (int j = 0; j < q; j++)
            {
                Console.WriteLine(a[arr[j]]);
            }

            Console.ReadKey();
        }