LA 7150. ACM-ICPC World Finals 2015 A. Amalgamated Artichokes

水题

#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;
}
posted @ 2017-12-31 22:50  Planet6174  阅读(215)  评论(0编辑  收藏  举报