Description
The summer training of Zju ICPC in July are about to end. To celebrate this great and happy day, the coaches of Zju ICPC Team Naviand Fancy decided to BG everyone ! Beside the coaches, there N is participants. Those participants is divided into four groups to make problems for other groups.
After a brief discussion, they decided to go to Lou Wai Lou and has a great lunch. The cost of each person to has a meal in Lou Wai Lou W is Yuan. Though It is very expensive, there are a special discount that Lou Wai Lou provided:for every K pers ONS, one of them can has a free meal.
Navi and Fancy would equally pay all the cost of this great BG. them to calculate how much money they each need to pay. By the the-the-the-minimum monetary unit of RMB is fen (0.01 yuan).
Input
There is multiple test cases (no more than 100).
For each test case, the there is only one line which contains three N numbers (1 N <= <= 100), (0 <= W <= 10000) K and (1 < = K <= 100). W
Output
For each test case, the output of the money a coaches need to pay, rounded into 0.01 yuan.
Sample Input
3 70 332) 999 1
Sample Output
140.000.00
The precision of this question still makes me feel puzzled
#include <cstdio>#include<cstring>#include<iostream>#include<algorithm>using namespacestd;intMain () {intn,k; DoubleW; while(SCANF ("%d%lf%d", &n,&w,&k)! =EOF) { Doubleans; Ans=w* (n+2-(n+2)/k)/2; printf ("%.2f\n", ans+0.0049); } return 0;}
View Code
ZOJ 3693 Happy Great BG (card accuracy)