Example #1
0
        static void Cookie_Clicker_Alpha()
        {
            int T = File_Manager.ReadInts()[0];

            for (int t = 0; t < T; t++)
            {
                List <double> CFX  = File_Manager.ReadDoubles();
                double        C    = CFX[0];
                double        F    = CFX[1];
                double        X    = CFX[2];
                double        rate = 2;
                double        time = 0;

                while (true)
                {
                    if ((X / (rate + F)) >= ((X - C) / rate))
                    {
                        time += X / rate;
                        break;
                    }
                    else
                    {
                        time += C / rate;
                        rate += F;
                    }
                }

                File_Manager.QueueLine("Case #" + (t + 1).ToString() + ": " + time.ToString("0.0000000"));
            }
        }
Example #2
0
        static void Deceitful_War()
        {
            int T = File_Manager.ReadInts()[0];

            for (int t = 0; t < T; t++)
            {
                int           N     = File_Manager.ReadInts()[0];
                List <double> Naomi = File_Manager.ReadDoubles();
                List <double> Ken   = File_Manager.ReadDoubles();
                Naomi.Sort();
                Ken.Sort();
                List <double> NW = new List <double>(Naomi);
                List <double> KW = new List <double>(Ken);

                int NWScore = 0;
                for (int n = N - 1; n >= 0; n--)
                {
                    if (NW[n] > KW[n])
                    {
                        NWScore++;
                        NW.RemoveAt(n);
                        KW.RemoveAt(0);
                    }
                    else
                    {
                        NW.RemoveAt(n);
                        KW.RemoveAt(n);
                    }
                }

                int NDWScore = 0;
                for (int n = N - 1; n >= 0; n--)
                {
                    if (Naomi[0] > Ken[0])
                    {
                        NDWScore++;
                        Naomi.RemoveAt(0);
                        Ken.RemoveAt(0);
                    }
                    else
                    {
                        Naomi.RemoveAt(0);
                        Ken.RemoveAt(n);
                    }
                }

                File_Manager.QueueLine("Case #" + (t + 1).ToString() + ": " + NDWScore + " " + NWScore);
            }
        }