题目链接:ZOJ 3827 Information Entropy

依据题目的公式算吧,那个极限是0

AC代码:

#include <stdio.h>
#include <string.h>
#include <math.h>
const double e=exp(1.0);
double find(char op[])
{
if(op[0]=='b')
return 2.0;
else if(op[0]=='n')
return e;
else if(op[0]=='d')
return 10.0;
}
int main()
{
int t,i,n;
double p[210],b;
char op[20];
scanf("%d",&t);
while(t--)
{
scanf("%d %s",&n,op);
b=find(op);
double ans=0.0;
for(i=0;i<n;i++)
{
scanf("%lf",&p[i]);
p[i]/=100.0;
if(p[i]!=0.0)
ans+=p[i]*log(p[i])/log(b);
}
printf("%.12lf\n",-ans);
}
return 0;
}

ZOJ 3827 Information Entropy (2014牡丹江区域赛)的更多相关文章

  1. zoj 3822 Domination(2014牡丹江区域赛D称号)

    Domination Time Limit: 8 Seconds      Memory Limit: 131072 KB      Special Judge Edward is the headm ...

  2. ACM学习历程——ZOJ 3822 Domination (2014牡丹江区域赛 D题)(概率,数学递推)

    Description Edward is the headmaster of Marjar University. He is enthusiastic about chess and often ...

  3. 2014 牡丹江现场赛 i题 (zoj 3827 Information Entropy)

    I - Information Entropy Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %l ...

  4. ZOJ 3827 Information Entropy(数学题 牡丹江现场赛)

    题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do? problemId=5381 Information Theory is one of t ...

  5. 2014 牡丹江区域赛 B D I

    http://acm.zju.edu.cn/onlinejudge/showContestProblems.do?contestId=358 The 2014 ACM-ICPC Asia Mudanj ...

  6. ZOJ 3827 Information Entropy 水题

    Information Entropy Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.zju.edu.cn/onlinejudge/sh ...

  7. ZOJ 3827 Information Entropy 水

    水 Information Entropy Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge Informati ...

  8. zoj 3827 Information Entropy 【水题】

    Information Entropy Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge Information ...

  9. ACM学习历程——ZOJ 3829 Known Notation (2014牡丹江区域赛K题)(策略,栈)

    Description Do you know reverse Polish notation (RPN)? It is a known notation in the area of mathema ...

随机推荐

  1. flutter 极光推送

    一.配置极光开发者 1.注册极光开发者 https://www.jiguang.cn/push 2.创建应用 二.创建APP 1.添加依赖 pubspec.yaml  添加: flutter_jpus ...

  2. C# 用程序读写另一个控制台程序

    一. using System; namespace ConsoleApp1 { class Program { static void Main(string[] args) { Console.W ...

  3. HDU 6208 The Dominator of Strings【AC自动机/kmp/Sunday算法】

    Problem Description Here you have a set of strings. A dominator is a string of the set dominating al ...

  4. CSU七月校赛A

    /*#include <iostream> #include<cstdio> #include<algorithm> #include<cstring> ...

  5. python 输入 与如何查看文档 小结

    Python 2 中的输入小结 转载请声明本文的引用出处:仰望大牛的小清新 1.raw_input(prompt = None)与input(prompt = None) 两个都是默认参数类型,这个参 ...

  6. 【状压基础题】poj3254 Corn Fields

    题目大意 :农夫约翰有n*m块地,其中一些地荒掉了.玉米是一种傲娇的植物,种在相邻的地里会导致不孕不育.求所有种法数对100000000求余. 读入:第一行一个n一个m, 接下来是一个n行m列的矩形, ...

  7. 福州3中集训day5

    数论,zld神犇认为我们都学过数论的,讲了一波高端(入门?)操作,从扩展欧几里得开始,同余方程诸如此类,早晚得重修.连课件都没,拿着画图讲了一上午 sro_zld_orz 具体内容都记在本上. 还是说 ...

  8. RPD Volume 168 Issue 4 March 2016 评论4

    Non-vascular interventional procedures: effective dose to patient and equivalent dose to abdominal o ...

  9. IDEA的Maven项目找不到class

  10. [xsy1140]求值

    $\newcommand{ali}[1]{\begin{align*}#1\end{align*}}$题意:给定$n,b,c,d,e,a_{0\cdots n-1}$,令$x_k=bc^{4k}+dc ...