Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.18 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. class MainClass {
  5.   public static void Main (string[] args) {
  6.       var aqualunger_input = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
  7.       var sharp_input = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
  8.      
  9.       int aq_x = aqualunger_input[0];
  10.       int aq_y = aqualunger_input[1];
  11.       int aq_h = aqualunger_input[2];
  12.  
  13.       int s_x = sharp_input[0];
  14.       int s_y = sharp_input[1];
  15.       int s_h = sharp_input[2];
  16.       int s_v = sharp_input[3];
  17.  
  18.       Func<int, int, float> time = (s, v) => s / v;
  19.      
  20.       float time_before_x = time(Math.Abs(aq_x - s_x), s_v);
  21.       float time_before_y = time(Math.Abs(aq_y - s_y), s_v);
  22.    
  23.       float time_before_death = time(s_h, s_v) + time_before_x + time_before_y;      
  24.       float time_to_escape = aq_h - time_before_x - time_before_y;
  25.  
  26.       float tmp = time_before_x + time_before_y;
  27.       float new_h = aq_h - tmp;
  28.  
  29.       if (new_h >= s_h) {
  30.         Console.WriteLine("NO");
  31.       } else if (time_to_escape >= time_before_death) {
  32.         Console.WriteLine("NO");
  33.       } else {
  34.         Console.WriteLine("YES");        
  35.       }
  36.  
  37.   }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement