水题
#include <cstdio>
#include <cmath>
#include <algorithm>
int main() {
int p, a, b, c, d, n;
scanf("%d%d%d%d%d%d", &p, &a, &b, &c, &d, &n);
double maxans = p * (sin(a + b) + cos(c + d) + 2), ans = 0;
for (int k = 2; k <= n; k++) {
double cur = p * (sin(a * k + b) + cos(c * k + d) + 2);
maxans = std::max(maxans, cur);
ans = std::max(ans, maxans - cur);
}
printf("%.9lf\n", ans);
return 0;
}