-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubmission.cpp
More file actions
38 lines (32 loc) · 927 Bytes
/
submission.cpp
File metadata and controls
38 lines (32 loc) · 927 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Submission on Yandex Constest
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
double v0, k0, a1, b1, a2, b2, t, n, step;
double v(double t) {
return v0 * cos(sqrt(a1 * a2) * t) - (k0 * sqrt(a2) * b1 * sin(sqrt(a1 * a2) * t)) / (b2 * sqrt(a1)) + a2 / b2;
}
double k(double t) {
return (v0 * sqrt(a1) * b2 * sin(sqrt(a1 * a2) * t)) / (b1 * sqrt(a2)) + k0 * cos(sqrt(a1 * a2) * t) + a1 / b1;
}
int main() {
cin >> v0 >> k0 >> a1 >> b1 >> a2 >> b2 >> t >> n;
step = t / n;
v0 -= a2 / b2;
k0 -= a1 / b1;
cout << "t:\n";
for (double i = 0; i <= t; i += step) {
cout << fixed << setprecision(2) << i << ' ';
}
cout << "\nv:\n";
for (double i = 0; i <= t; i += step) {
cout << v(i) << ' ';
}
cout << '\n' << "k:\n";
for (double i = 0; i <= t; i += step) {
cout << k(i) << ' ';
}
cout << '\n';
return 0;
}