Build a program which calculates the launch angle for which a target located at a given distance (greater than 1 km and less than the maximum range) is hit with an accuracy of 3m. Dynamically simulate the projectile's motion until it reaches the target.
Note: There are two solutions; the one that ensures the shortest time (smaller angle) will be chosen.