题目链接:http://www.ifrog.cc/acm/problem/1137

题解:设m=n-z

sin(x)+sin(y)=sin(m-y)+sin(y)利用公式得最大值为sqrt(sin(m)*sin(m)+(1-cos(m))*(1-cos(m)))

所以只要便利一下z就可以了。

#include <iostream>
#include <cstring>
#include <cmath>
#include <cstdio>
#define Pi acos(-1)
using namespace std; int main() {
int n;
scanf("%d" , &n);
double ans = 0 , Max = -3;
for(int i = 1 ; i <= n ; i++) {
int z = i;
int m = n - z;
Max = max(Max , sin(1.0 * z) + 1.0 * sqrt(sin(1.0 * m) * sin(1.0 * m) + (1.0 - cos(1.0 * m)) * (1.0 - cos(1.0 * m))));
}
printf("%.9lf\n" , Max);
return 0;
}

最新文章

  1. LeetCode 345. Reverse Vowels of a String
  2. python---filecmp
  3. xcode 自定义Eclipse里边常用的快捷键
  4. 学习笔记(一)——MVC扩展
  5. thinkphp空控制器的处理
  6. iOS 时间戳
  7. Android自动检测版本及自动升级
  8. c++11 内存模型解读
  9. API 版本控制
  10. CSS3写常用的形状
  11. Runtime.exec()
  12. Asp.Net--回调技术
  13. JS如何判断IE和火狐与Chrome浏览器
  14. UNIX/Linux-进程控制(实例入门篇)
  15. 开启和禁用Wifi热点命令
  16. HDU-1275-两车追及或相遇问题(数学题目)
  17. 集群RPC通信
  18. Python 入门:基本语法
  19. Java基础系列--ArrayList集合
  20. week6:个人博客作业

热门文章

  1. 安装使用xen虚拟化工具
  2. 为什么for循环可以遍历list:Python中迭代器与生成器
  3. C++ protobuffer 前后端通信 简单应用
  4. python3 编译安装
  5. 【React踩坑记一】React项目中禁用浏览器双击选中文字的功能
  6. 如何让传统ASP.NET网站在Docker中运行
  7. [Spring cloud 一步步实现广告系统] 15. 使用开源组件监听Binlog 实现增量索引准备
  8. maven3实战之仓库
  9. 趣味CSS3效果挑战小汇总
  10. fatal: remote origin already exists.解决方法