2015百度之星资格赛1006_单调区间

来源:互联网 发布:电销数据是什么 编辑:程序博客网 时间:2024/06/03 01:54

///////////////////////////////////////////////////////////////////////////////////////////////////////
作者:tt267
声明:本文遵循以下协议自由转载-非商用-非衍生-保持署名|Creative Commons BY-NC-ND 3.0
转载请注明:http://blog.csdn.net/tt2767/article/details/45966891
///////////////////////////////////////////////////////////////////////////////////////////////////////


题目链接:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=584&pid=1006

一道老题了,这题的思想Matrix67大神的博客上就有:
http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=584&pid=1006

#include<stdio.h>#include<string.h>#include<stdlib.h>#include<algorithm>#define INF 999999999using namespace std;double js1(int);double js2(int);int main(){    int n,Case,id=1;    double res,ave;    scanf("%d",&Case);    while(Case--)    {        printf("Case #%d:\n",id++);        scanf("%d",&n);        printf("%.6lf %.6lf\n",js1(n)+1,js2(n));    }    return 0;}double js1(int n){    return (double)(n-2)*19/27;}double js2(int n){    return (double)(46-(double)38/n)/(19-(double)11/n);}
0 0
原创粉丝点击