Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* e144 */
- /* AC (2ms, 136KB) */
- #include <cstdio>
- #include <cmath>
- using namespace std;
- const double g = 9.8, pi = acos(-1.0);
- int angle, v0, t, T;
- double Vy, Vx, Sy, Sx;
- double Convert(int a)
- {
- return (double)a * pi / 180;
- }
- int main()
- {
- scanf("%d", &T);
- while(T-- && ~scanf("%d %d %d", &v0, &angle, &t))
- {
- if(angle == 360) angle = 0;
- Vx = v0 * cos(Convert(angle));
- Vy = v0 * sin(Convert(angle)) - g * t;
- Sx = Vx * t;
- Sy = v0 * sin(angle * pi / 180) * t - g * t * t / 2;
- if(abs(Sx - 0.0) <= 1e-6) Sx = 0.0;
- if(abs(Sy - 0.0) <= 1e-6) Sy = 0.0;
- printf("x: %.2f, y: %.2f at %d(s) ", Sx, Sy, t);
- if(abs(Vy - 0.0) <= 1e-6) printf("rest");
- else if(Vy > 0.0) printf("rising");
- else printf("falling");
- puts("");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement