ZOJ 3693 Happy Great BG (card accuracy)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.