ZCMU 1512: Monster

博客讲述男孩ZDD为救女友SZD,途中要打N个怪物,杀怪概率为P,杀一个怪可得M把钥匙,需计算能获取钥匙数量的期望。给出输入输出格式,包括测试用例数、怪物数、杀怪概率和得钥匙数等信息。

1512: Monster

Description
There was a boy called ZDD, and he loved a girl whose name is SZD. He loved her very much, and after answering the question, SZD became ZDD’s girlfriend. They fell in love with each other deeply. But the happy time wasn’t longer. One day SZD was caught by a big boss called TIANKENG. And ZDD decided to save his lover. On his way to TIANKENG’s castle, there was N monsters. And ZDD can kill the monster with a probability P. If ZDD killed one monster, he could get M keys. ZDD wanted to know what is the expectation of the number of keys he can get?

Input
The first line is an integer T, which indicates the number of test case.
For each test case, there are three integers N, P, M (1<=N<=10000, 0<=p<=100, 1<=M<=10000), which indicates the number of monsters, the probability of kill a monster, and the number of keys he can get.

Output
For each test case, you should print the answer in one line with two decimal places.

Sample Input

2
10 100 10
10 50 1

Sample Output

100.00
5.00

HINT
水体。
Code:

#include<stdio.h>
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        int N,M;
        double P;
        scanf("%d %lf %d",&N,&P,&M);
        printf("%.2lf\n",N*(P/100)*M);
    }
    return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值