Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.IO;
- using System.Threading;
- using System.Globalization;
- public class Solution
- {
- // insert your code here
- private void Solve()
- {
- }
- bool ONLINE_JUDGE;
- public static void Main(string[] args)
- {
- new Solution().Run();
- }
- public void Run()
- {
- try
- {
- Init();
- Solve();
- output.Close();
- }
- catch (Exception e)
- {
- Console.Error.WriteLine(e.StackTrace);
- Console.Error.Flush();
- throw e;
- }
- }
- private TextReader input;
- private TextWriter output;
- private string[] INPUT_BUFFER;
- private int INPUT_BUFFER_INDEX;
- private char[] DELIMITERS = new char[] { ' ', '\t' };
- private void Init()
- {
- #if (ONLINE_JUDGE)
- ONLINE_JUDGE = true;
- #else
- ONLINE_JUDGE = false;
- #endif
- try
- {
- Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
- }
- catch (Exception ignored)
- {
- }
- if (ONLINE_JUDGE)
- {
- input = Console.In;
- output = Console.Out;
- }
- else
- {
- string projectPath = Path.GetFullPath(@"..\..\");
- input = new StreamReader(new FileStream(projectPath + "input.txt", FileMode.OpenOrCreate));
- output = new StreamWriter(new FileStream(projectPath + "output.txt", FileMode.Create));
- }
- INPUT_BUFFER = new string[0];
- INPUT_BUFFER_INDEX = 0;
- }
- private string ReadLine() { return input.ReadLine(); }
- private string ReadString()
- {
- while (INPUT_BUFFER_INDEX == INPUT_BUFFER.Length)
- {
- INPUT_BUFFER = ReadLine().Split(DELIMITERS, StringSplitOptions.RemoveEmptyEntries);
- INPUT_BUFFER_INDEX = 0;
- }
- return INPUT_BUFFER[INPUT_BUFFER_INDEX++];
- }
- private int ReadInt() { return Int32.Parse(ReadString()); }
- private long ReadLong() { return Int64.Parse(ReadString()); }
- private double ReadDouble() { return Double.Parse(ReadString()); }
- private void WriteDouble(double value)
- {
- NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;
- output.Write(string.Format(nfi, "{0}", value));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement