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. 【初级】linux rm 命令详解及使用方法实战

    rm:删除命令 前言: windows中的删除命令大家都不陌生,linux中的删除命令和windows中有一个共同特点,那就是危险,前两篇linux mkdir 命令详解及使用方法实战[初级]中我们就 ...

  2. ie8 window.open导出文件报错

    js创建一个<a>元素hiddenElementhiddenElement.setAttribute('href','')hiddenElement.setAttribute('targe ...

  3. java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException

    问题描述: 严重: IOException while loading persisted sessions: java.io.WriteAbortedException: writing abort ...

  4. XPath

    XPath即为XML路径语言,它是一种用来确定XML(标准通用标记语言的子集)文档中某部分位置的语言.XPath基于XML的树状结构,提供在数据结构树中找寻节点的能力. XPath的需要理解的相关概念 ...

  5. 【转】silverlight telerik RadGridView 列头显示其他控件

    <telerik:GridViewDataColumn DataMemberBinding="{Binding target_id}" IsFilterable=" ...

  6. The Nine Indispensable Rules for HW/SW Debugging 软硬件调试之9条军规

    I read this book in the weekend, and decided to put the book on my nightstand. It's a short and funn ...

  7. 《Linux内核分析》实验一

    陈智威,<Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 课堂学习笔记: 作业截图: 汇编代码堆栈分析: ...

  8. C++Promise函数

    Promise内部会建立一个shared state是用来放一个相应的类型的值或是一个异常,并可被future object 取其数据当线程结果 promise是在形成成果后才将结果放进shared ...

  9. SE1-soc入手又有的东西可以玩了

    笔者之前只有DE2-35 和DE2-70 两个板子用,相比之下亮点主要是:配备了DDR3 的存储器,视频处理能处理更高帧频和画幅数了,此外直接有了USB2.0接口,还配有A9 Arm双核芯片,功能一下 ...

  10. CRYPTO-MD5

    这是昨天WHUCTF比赛的一道题目,本属于crypto,其实和crypto没多大关系, 比赛时其实差不多有这种思路了,但不相信自己,就没这样做下去,回来之后,照做了,果然是这样 链接:http://p ...