Happy Great BG
来源:互联网 发布:数组下标越界异常 编辑:程序博客网 时间:2024/06/10 19:38
The summer training of ZJU ICPC in July is about to end. To celebrate this great and happy day, the coaches of ZJU ICPC TeamNavi 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 332 999 1
Sample Output
140.000.00WA了无数次,结果是需要四舍五入的,而直接输出并不能完全做到四舍五入
#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;
int main(){
double w ;
int n, k;
while(scanf("%d %lf %d",&n, &w, &k) != EOF){
int res =(n + 2)/k;
double ans = (n + 2 - res)*1.0 * w/2.0;
printf("%.2lf\n",floor(ans*100+0.5)/100.0);
}
return 0;
}
- Happy Great BG
- Happy Great BG
- Happy Great BG
- ZOJ 3693 Happy Great BG
- Happy Great BG 精度控制
- ZOJ 3693 Happy Great BG
- L - Very Happy Great BG
- zoj-3693-Happy Great BG
- ZOJ3947-Very Happy Great BG
- ZOJ 3693 Happy Great BG(进位问题)
- ZOJ 3693 Happy Great BG 解题报告
- ZOJ 3947Very Happy Great BG
- zoj-3947-Very Happy Great BG
- Zoj 3947 Very Happy Great BG【水】
- 省AK赛——J - Happy Great BG
- ZOJ 3693 Happy Great BG 要加eps
- ZOJ 3947 Very Happy Great BG(水题)
- 13届浙江省省赛 L题 Very Happy Great BG
- 常见面试第三题之Activity的几种启动模式介绍
- ajax学习过程
- python利用requests框架 http请求
- MySQL for Windows 解压缩版配置安装
- 在代码中修改textview的字体颜色(解决只能修改一次的问题)
- Happy Great BG
- 洛谷1111 修复公路
- hdu 1082
- asp.net常用控件之一,GridView
- POJ 1191 棋盘分割
- 矩阵乘法
- ASCII总结
- iOS-UIActionSheet提示框
- 删除链表中倒数第k个节点