Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Console.WriteLine("Task: I_3");
- static double S(double v, double a, double t)
- {
- return v * t + a * t * t / 2;
- }
- static double tt(double v1, double a1, double v2, double a2)
- {
- //S1 = v1*t + a1*t*t/2 == S2 = v2*t + a2*t*t/2
- //(a2-a1)*t*t + 2*(v2-v1)*t == 0. t > 0
- //(a2-a1)*t = -2 * (v2-v1)
- return -2 * (v2 - v1) / (a2 - a1);
- }
- double s11 = S(10, 1, 1), s12 = S(9, 1.6, 1), s21 = S(10, 1, 4), s22 = S(9, 1.6, 4);
- string c1 = s11 > s12 ? ">" : (s11 < s12 ? "<" : "=="),
- c2 = s21 > s22 ? ">" : (s21 < s22 ? "<" : "==");
- Console.WriteLine("At 1 hour: first made {0} which is " + c1 + " than second's {1}", s11, s12);
- Console.WriteLine("At 4 hours: first made {0} which is " + c2 + " than second's {1}", s21, s22);
- Console.WriteLine("They'll meet at {0:0.##} hours", tt(10, 1, 9, 1.6));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement