码迷,mamicode.com
首页 > 移动开发 > 详细

ZOJ 3693 Happy Great BG

时间:2015-08-15 06:46:47      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:zoj 3693 happy great   精度   

Happy Great BG

Time Limit: 2 Seconds      Memory Limit: 65536 KB

The summer training of ZJU ICPC in July is about to end. To celebrate this great and happy day, the coaches of ZJU ICPC Team Navi and Fancy decided to BG everyone! Beside the two coaches, there are N participants. Those participants are divided into four groups to make problems for other groups.

技术分享

After a brief discussion, they decided to go to Lou Wai Lou and have a great lunch. The cost for each person to have a meal in Lou Wai Lou is W yuan. Though it is very expensive, there is a special discount that Lou Wai Lou provided: for every K persons, one of them can have a free meal.

Navi and Fancy will equally pay all the cost for this great BG. Please help them to calculate how much money they each need to pay. By the way, please take care that the minimum monetary unit of RMB is fen (0.01 yuan).

Input

There are multiple test cases (no more than 100).

For each test case, there is only one line which contains three numbers N (1 <= N <= 100), W (0 <= W <= 10000) and K (1 < = K <= 100).

Output

For each test case, output the money a coach need to pay, rounded into 0.01 yuan.

Sample Input

3 70 3
32 999 1

Sample Output

140.00
0.00

#include<cstring>
#include<cstdio>
#include<algorithm>
#include<iostream>

using namespace std;

int main() {
    //freopen("test.in","r",stdin);
    int n,k;
    double m;
    while(cin>>n>>m>>k) {
        n+=2;
        double ans=(n-(n/k))*m/2.0;
        printf("%.2f\n",ans+1e-10);
    }
    return 0;
}



版权声明:本文为博主原创文章,未经博主允许不得转载。

ZOJ 3693 Happy Great BG

标签:zoj 3693 happy great   精度   

原文地址:http://blog.csdn.net/acm_baihuzi/article/details/47675203

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!