コード例 #1
0
        static void Main(string[] args)
        {
            tests        tests         = new tests();
            StreamReader input_stream  = new StreamReader("input.txt");
            StreamWriter output_stream = new StreamWriter("output.txt");
            Stopwatch    stopWatch     = new Stopwatch();

            int[][] input_matrix;
            int     N, K;

            while (!input_stream.EndOfStream)
            {
                string[] temp = input_stream.ReadLine().Split(' ');
                N            = Int32.Parse(temp[0]); K = Int32.Parse(temp[1]);
                input_matrix = new int[N][];
                for (int i = 0; i < N; i++)
                {
                    input_matrix[i] = new int[K];
                    temp            = input_stream.ReadLine().Split(' ');
                    for (int j = 0; j < K; j++)
                    {
                        input_matrix[i][j] = Int32.Parse(temp[j]);
                    }
                }
                stopWatch.Restart();
                output_stream.WriteLine(maxSubMatrix(input_matrix));
                output_stream.WriteLine(stopWatch.Elapsed);
            }
            output_stream.Close();
            input_stream.Close();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Stopwatch    stopWatch = new Stopwatch();
            tests        new_tests = new tests();
            StreamWriter output_stream;

            stopWatch.Start();
            StreamReader  input_stream;
            List <string> buffer = new List <string>();

            while (global_flag)
            {
                global_flag = false;
                buffer.Clear();
                output_stream = new StreamWriter("output.txt");
                input_stream  = new StreamReader("input.txt");
                while (!input_stream.EndOfStream)
                {
                    string temp = input_stream.ReadLine();
                    if (buffer.Count == 0)
                    {
                        buffer.Add(temp);
                    }
                    else if (buffer.Count == 1)
                    {
                        buffer.Add(temp);
                        FindMax(buffer);
                    }
                    else
                    {
                        Operate(output_stream, buffer, temp);
                    }
                }
                output_stream.WriteLine(buffer[1]);
                output_stream.WriteLine(buffer[0]);

                if (global_flag)
                {
                    output_stream.Close();
                    input_stream.Close();
                    output_stream = new StreamWriter("input.txt");
                    input_stream  = new StreamReader("output.txt");
                    output_stream.WriteAsync(input_stream.ReadToEnd());
                    output_stream.Close();
                    input_stream.Close();
                }
                else
                {
                    input_stream.Close();
                    stopWatch.Stop();
                    output_stream.WriteLine(stopWatch.Elapsed);
                    output_stream.Close();
                }

                Console.WriteLine("Waiting");
            }
            Console.WriteLine("THATSALL");
            Console.ReadKey();
        }