zoukankan      html  css  js  c++  java
  • zoj 3693, 卡精度

    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
    

    Author: JIANG, Kai
    Contest: ZOJ Monthly, March 2013

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<string>
    #include<cmath>
    #include<vector>
    #include<cstdlib>
    #include<algorithm>
    
    using namespace std;
    
    #define LL long long
    #define ULL unsigned long long
    #define UINT unsigned int
    #define MAX_INT 0x7fffffff
    #define MAX_LL 0x7fffffffffffffff
    #define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
    #define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
    
    #define EPS 1e-8
    
    int main(){
    //  fstream fin("C:\Users\Administrator\Desktop\in.txt",ios::in);
      //  freopen("C:\Users\Administrator\Desktop\in.txt","r",stdin);
        int n,k;
        double w;
        while(scanf(" %d %lf %d",&n,&w,&k)==3){
            n+=2;
            double s= w*(n-n/k)/2 + EPS;
            printf("%.2f
    ",s);
        }
    
    //  fin.close();
        return 0;
    }
    
  • 相关阅读:
    OracleSql语句学习(一)
    java(2019)面试题整理所
    用Eclipse中的git提交代码流程
    C# 导出数据到Excel模板中(转)
    C# 导出Excel的示例(转)
    JS中window.showModalDialog()详解(转)
    C#多线程编程(转)
    文件各种上传,离不开的表单(转自——因为菜,所以要好好学习、天天向上! —— 农码一生)
    WebApi Ajax 跨域请求解决方法(CORS实现)(作者:jianxuanbing)
    如何将ASP.NET-WebApi发布到IIS6.0上(转)
  • 原文地址:https://www.cnblogs.com/ramanujan/p/3413022.html
Copyright © 2011-2022 走看看