2015百度之星资格赛1003_IP聚合

///////////////////////////////////////////////////////////////////////////////////////////////////////
作者:tt267
声明:本文遵循以下协议自由转载-非商用-非衍生-保持署名|Creative Commons BY-NC-ND 3.0
转载请注明:http://www.jb51.cc/article/p-bjxelvsw-bkd.html
///////////////////////////////////////////////////////////////////////////////////////////////////////

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

一道水题,就是有点麻烦,慢慢码就好。。

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#define INF 999999999
using 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);
}

相关文章

迭代器模式(Iterator)迭代器模式(Iterator)[Cursor]意图...
高性能IO模型浅析服务器端编程经常需要构造高性能的IO模型,...
策略模式(Strategy)策略模式(Strategy)[Policy]意图:定...
访问者模式(Visitor)访问者模式(Visitor)意图:表示一个...
命令模式(Command)命令模式(Command)[Action/Transactio...
生成器模式(Builder)生成器模式(Builder)意图:将一个对...