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[] cache; int cache_size, num_of_requests; List <int> requests; string[] input; while (!input_stream.EndOfStream) { input = input_stream.ReadLine().Split(' '); cache_size = Int32.Parse(input[0]); num_of_requests = Int32.Parse(input[1]); cache = new int[cache_size]; requests = new List <int>(); for (int i = 0; i < num_of_requests; i++) { requests.Add(Int32.Parse(input_stream.ReadLine())); } stopWatch.Restart(); output_stream.WriteLine(countOfRequests(cache, requests)); output_stream.WriteLine(stopWatch.Elapsed); } output_stream.Close(); input_stream.Close(); }
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[,] cities; string[] input; int num_of_cities, length_of_journey; while (!input_stream.EndOfStream) { input = input_stream.ReadLine().Split(' '); num_of_cities = Int32.Parse(input[0]); length_of_journey = Int32.Parse(input[1]); cities = new int[num_of_cities, length_of_journey]; for (int i = 0; i < num_of_cities; i++) { input = input_stream.ReadLine().Split(' '); for (int j = 0; j < length_of_journey; j++) { cities[i, j] = Int32.Parse(input[j]); } } stopWatch.Restart(); dinamicSolution(cities, output_stream); output_stream.WriteLine(stopWatch.Elapsed); } input_stream.Close(); output_stream.Close(); }
static void Main(string[] args) { tests new_tests = new tests(); StreamReader input_stream = new StreamReader("input.txt"); StreamWriter output_stream = new StreamWriter("output.txt"); Stopwatch stopWatch = new Stopwatch(); List <double> capitals = new List <double>(); int number_of_firms; while (!input_stream.EndOfStream) { number_of_firms = Int32.Parse(input_stream.ReadLine()); capitals.Clear(); string[] input = input_stream.ReadLine().Split(' '); for (int i = 0; i < number_of_firms; i++) { capitals.Add((double)Int32.Parse(input[i]) / 100); } stopWatch.Restart(); capitals.Sort(); output_stream.WriteLine(Merge(capitals)); output_stream.WriteLine(stopWatch.Elapsed); } input_stream.Close(); output_stream.Close(); }
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(); HashSet <string> ideals; string[] input; while (!input_stream.EndOfStream) { input = input_stream.ReadLine().Split(' '); int num_of_ideals = Int32.Parse(input[0]), num_of_elements = Int32.Parse(input[1]), num_of_checks = Int32.Parse(input[2]); ideals = new HashSet <string>(); for (int i = 0; i < num_of_ideals; i++) { input = input_stream.ReadLine().Split(' '); Array.Sort(input); ideals.Add(String.Join(" ", input)); } Console.WriteLine("Starting..."); stopWatch.Restart(); for (int i = 0; i < num_of_checks; i++) { input = input_stream.ReadLine().Split(' '); Array.Sort(input); if (ideals.Contains(String.Join(" ", input))) { output_stream.WriteLine(1); } else { output_stream.WriteLine(0); } } output_stream.WriteLine(stopWatch.Elapsed); } output_stream.Close(); input_stream.Close(); }