link:http://codeforces.com/contest/345/problem/A

写完这道题目才发现这场比赛只能用Ada语言提交==

好吧,逗我玩呢

考的是数学期望公式,二项分布的期望E=np

C++代码:(我可不会Ada……=_=)

 #include <cstdio>
 #include <cstdlib>
 #include <iostream>
 #include <cstring>
 using namespace std;
 int main(void)
 {
   ];
   double p;
   #ifndef ONLINE_JUDGE
   freopen("in.txt", "r", stdin);
   #endif // ONLINE_JUDGE
   while (~scanf("%s%lf", a, &p))
   {
     int len = strlen(a);
     ;
     ;
     ; i < len; ++i)
     {
       ') cnt++;
       else if (a[i] == '?') cnt1++;
     }
     double Cnt = (double)cnt + p * (double)cnt1;
     printf("%.5lf\n", Cnt/(double)len);
   }

   ;
 }

从今天起,每天一到两题。

codeforces Expecting Trouble的更多相关文章

  1. Codeforces Round #648 (Div. 2) B. Trouble Sort

    一开始读错题了...想当然地认为只能相邻元素交换...(然后换了两种写法WA了4发,5分钟切A的优势荡然无存) 题目链接:https://codeforces.com/contest/1365/pro ...

  2. Codeforces 593B Anton and Lines

    LINK time limit per test 1 second memory limit per test 256 megabytes input standard input output st ...

  3. CodeForces 148B Escape

    Escape Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Stat ...

  4. Codeforces Round #329 (Div. 2) B. Anton and Lines 逆序对

    B. Anton and Lines Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/593/pr ...

  5. [刷题]Codeforces 794C - Naming Company

    http://codeforces.com/contest/794/problem/C Description Oleg the client and Igor the analyst are goo ...

  6. Codeforces Round #408 (Div. 2)(A.水,B,模拟)

    A. Buying A House time limit per test:2 seconds memory limit per test:256 megabytes input:standard i ...

  7. [Codeforces 864E]Fire

    Description Polycarp is in really serious trouble — his house is on fire! It's time to save the most ...

  8. Codeforces Round #408 (Div. 2) A B C 模拟 模拟 set

    A. Buying A House time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  9. CodeForces - 796B-Find The Bone(模拟)

    Zane the wizard is going to perform a magic show shuffling the cups. There are n cups, numbered from ...

随机推荐

  1. 最近用到js筛选一个url的域名部分(草创)

    var TLD = ['com','net','org','gov','edu','mil','biz','name','info','mobi','cn','hk']; var host = ''; ...

  2. hudson slave搭建

     Hudson Slave搭建   使用Hudson搭建分布式的构建环境非常方便,客户端也不需要太多的操作,只要能执行java命令就行. hudson默认采用master方式进行安装,master作为 ...

  3. eap-ttls/mschapv2

    eap-ttls/mschapv2       文件路径 用途 示例 备注 #gedit /usr/local/etc/raddb/sites-available/default #gedit /us ...

  4. JS 笔记(二) - 函数

    1. 函数的 声明 1) 声明式写法 function j1(id){ alert(id); } 2) 声明匿名函数变量 var j2 = function (a, b) { alert(a + &q ...

  5. 项目组J2ee程序员的标志,你中招没 转载+评论

    原文在此 校园级别的程序员的标志: 代码中最多的是嵌套if(null == xxx),还要告诉你,null必须写在前面,我靠. 防止把==写成=,c语言时代常犯的错误.由于null不能做左值,在写=的 ...

  6. C#同一项目中不同文件或类中的方法进行调用

    有两种方法,一是将被调用的类设置成静态类Static,这样就可以直接点出来了,二是将被调用的方法所在类设置成public,这几必须在调用类中先将被调用的类进行实体化,new()出来,再点出来. 一. ...

  7. python基础之内置函数

    该博客内容参考http://www.cnblogs.com/wupeiqi/articles/4943406.html 内置函数 一 详细见python文档,猛击这里 文件操作 操作文件时,一般需要经 ...

  8. liunx中字符驱动编写的简单模板

    下面是关于字符驱动两个程序,主要是说明驱动编写的思想,理解驱动是怎么一步一步被实现的. 驱动的第一个实现程序,是相对于裸机编程的,主要是体会一下驱动编程思想: cdev.h: 所包含的头文件 #ifn ...

  9. 用Python3实现表达式求值

    一.题目描述 请用 python3 编写一个计算器的控制台程序,支持加减乘除.乘方.括号.小数点,运算符优先级为括号>乘方>乘除>加减,同级别运算按照从左向右的顺序计算. 二.输入描 ...

  10. tab使用 TabActivity TabHost Tabspec常用方法

    本文是参考Android官方提供的sample里面的ApiDemos的学习总结.   TabActivity   首先Android里面有个名为TabActivity来给我们方便使用.其中有以下可以关 ...