AmidamaruZXC

Untitled

Feb 8th, 2020
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.10 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace TaskC
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             int year, month, day, period, count = 0;
  15.             string[] date = Console.ReadLine().Split(' ');
  16.             year = int.Parse(date[0]);
  17.             month = int.Parse(date[1]);
  18.             day = int.Parse(date[2]);
  19.             period = int.Parse(Console.ReadLine());
  20.             string[] concentration = Console.ReadLine().Split(' ');
  21.             double current = double.Parse(concentration[0], CultureInfo.InvariantCulture);
  22.             double old = double.Parse(concentration[1], CultureInfo.InvariantCulture);
  23.             while (current > old)
  24.             {
  25.                 current /= 2;
  26.                 count += period;
  27.             }
  28.             DateTime start = new DateTime(year, month, day);
  29.             DateTime end = start.AddDays(count);
  30.             Console.WriteLine(end.Year + " " + end.Month + " " + end.Day);
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment