示例#1
0
 /// <summary>
 /// Reads a test case
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public CodeJamProblem BuildProblem(CodeJamInput input)
 {
     string[] numbers = input.NextLine().Split(' ');
     this.r = long.Parse(numbers[0]);
     this.t = long.Parse(numbers[1]);
     return(this);
 }
示例#2
0
文件: 3.cs 项目: qifanyyy/CLCDSA
        /// <summary>
        /// Reads a test case and initializes the class' variables
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public CodeJamProblem BuildProblem(CodeJamInput input)
        {
            N = int.Parse(input.NextLine());

            Graph = input.NextLine().Split(' ').Select(i => int.Parse(i) - 1).ToArray();

            return(this);
        }
示例#3
0
文件: 3.cs 项目: qifanyyy/CLCDSA
        /// <summary>
        /// Reads a test case and initializes the class' variables
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public CodeJamProblem BuildProblem(CodeJamInput input)
        {
            N = int.Parse(input.NextLine());

            Lists = new int[2 * N - 1][];

            for (int i = 0; i < 2 * N - 1; i++)
            {
                Lists[i] = input.NextLine().Split(' ').Select(n => int.Parse(n)).ToArray();
            }

            return(this);
        }
示例#4
0
文件: 3.cs 项目: Kawser-nerd/CLCDSA
        static void Main(string[] args)
        {
            //Reads the input
            CodeJamInput  input  = new CodeJamInput();
            StringBuilder output = new StringBuilder();

            foreach (CodeJamProblem p in input.problems)
            {
                //Solves each test case
                output.AppendLine(p.GetSolution());
            }

            //Print results to file
            File.WriteAllText(outputPath, output.ToString());
        }
示例#5
0
文件: 3.cs 项目: Kawser-nerd/CLCDSA
        /// <summary>
        /// Reads a test case
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public CodeJamProblem BuildProblem(CodeJamInput input)
        {
            string[] numbers = input.NextLine().Split(' ');
            this.MaxEnergy = long.Parse(numbers[0]);
            CurEnergy      = MaxEnergy;
            this.R         = long.Parse(numbers[1]);
            this.N         = long.Parse(numbers[2]);
            R       = R > MaxEnergy ? MaxEnergy : R;
            numbers = input.NextLine().Split(' ');
            values  = new long[N];
            for (int i = 0; i < N; i++)
            {
                values[i] = long.Parse(numbers[i]);
            }

            return(this);
        }
示例#6
0
        /// <summary>
        /// Reads a test case and initializes the class' variables
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public CodeJamProblem BuildProblem(CodeJamInput input)
        {
            S = input.NextLine();

            return(this);
        }