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. 前端开发week3

    开发工具学习ing... lesscss 框架 lesscss是一种动态样式语言,属于css预处理语言的一种,它使用类似css的语法,为css的赋予了动态语言的特性,如变量.继承.运算.函数等,更方便 ...

  2. setProgressBarIndeterminateVisibility(true);

    此为在标题栏 上 设置一个loading 圈  实用...

  3. EF升级6.0数据库链接不上问题

    昨天搞了个mvc4  先从net4.0 升级4.5后 数据库连接不上了,  然后升级ef未最新的6.1  居然还报错 不到方法:“System.Data.Objects.ObjectContext S ...

  4. easyui tabs update后tab上关闭图标失效的解决方案

    问题:使用easyui的tabs组件的时候,调用了tab的update方法,更新后的tab标签上的关闭图标失效 使用的js文件是1.3版本的jquery.easyui.min.js文件,通过读源文件发 ...

  5. python 异常处理学习笔记

    搬运至慕课网,精华截图,视频链接在这  : http://www.imooc.com/learn/457 1. 异常检查目的 2. python 可能出现的异常 3. 异常的处理过程 try - ex ...

  6. SQLite常用命令总结

    1) 创建数据库文件: >SQLite3 d:\test.db 回车 就生成了一个test.db在d盘. 这样同时也SQLite3挂上了这个test.db 2) 用.help可以看看有什么命令 ...

  7. SQL-表的各种查查查

    use Student gocreate table student1(code int,name varchar (20),sex char(10),tizhong decimal(18,1),ag ...

  8. Ubuntu14.04安装build-essential失败,包依赖问题如何解决?

    正在读取软件包列表... 完成 正在分析软件包的依赖关系树        正在读取状态信息... 完成        有一些软件包无法被安装.如果您用的是 unstable 发行版,这也许是 因为系统 ...

  9. Reverse-Daily(5)-RE_100

    比较简单的一道题目,主要注意方法一 链接:http://pan.baidu.com/s/1c1U8a4K 密码:cnkq 我用了两种方法 方法一: nop掉几处无关的call指令,然后直接运行程序,但 ...

  10. cell 内部 设置width 总不对

    今天 在Cell 里设置屏幕宽 如果 在layoutSubviews 使用 self.width(自己写的分类) 或者 self.view.size.width  都可以,这里 4 4s 5 5s 都 ...