codeforces Expecting Trouble
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的更多相关文章
- Codeforces Round #648 (Div. 2) B. Trouble Sort
一开始读错题了...想当然地认为只能相邻元素交换...(然后换了两种写法WA了4发,5分钟切A的优势荡然无存) 题目链接:https://codeforces.com/contest/1365/pro ...
- Codeforces 593B Anton and Lines
LINK time limit per test 1 second memory limit per test 256 megabytes input standard input output st ...
- CodeForces 148B Escape
Escape Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Stat ...
- 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 ...
- [刷题]Codeforces 794C - Naming Company
http://codeforces.com/contest/794/problem/C Description Oleg the client and Igor the analyst are goo ...
- 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 ...
- [Codeforces 864E]Fire
Description Polycarp is in really serious trouble — his house is on fire! It's time to save the most ...
- 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 ...
- CodeForces - 796B-Find The Bone(模拟)
Zane the wizard is going to perform a magic show shuffling the cups. There are n cups, numbered from ...
随机推荐
- TCP、UDP、RTP(RTCP)异同与区别
OSI七层模型OSI 中的层 功能 TCP/IP协议族 应 用层 ...
- powershell读写磁盘变量(对象序列化)
---[第一章,开篇引子]--- 很久很久以前,我在网上闲逛,看到一头powershell菜鸟,写了一篇感慨道“挖哈哈,我学会powershell啦,我以前很笨,各种不懂,还想把变量保存起来.” 实际 ...
- android 在使用studio 编写百度地图中遇到APP Scode码校验失败 问题
直接用打包出来的apk查看签名,具体如下: 1) 将apk修改后缀为 .zip文件后解压: 2) 进入解压后的META-INF目录,该目录下会存在文件CERT.RSA 3) 在该目录下打开cmd,输入 ...
- Oracle函数over(),rank()over()作用及用法--分区(分组)求和& 不连续/连续排名
(1) 函数: over()的作用及用法: -- 分区(分组)求和. RANK ( ) OVER ( [query_partition_clause] order_by_clause )D ...
- 一个自定义控件的Demo
里面包括Button.Checkbock.listview.popupwindow的自定义 import android.app.Activity; import android.content.In ...
- c语言问卷调查
你对自己的未来有什么规划?做了哪些准备? 找一家公司实习积攒创业基金.努力学习专业知识,从各方面完善自身,参与各项活动如辩论赛,竞赛等锻炼自己. 2.你认为什么是学习?学习有什么用?现在学习动力如何? ...
- HeadFirst 设计模式
一.设计原则 封装变化 多用组合,少用继承 针对接口编程,不针对实现编程 为交互对象之间的松紧耦合设计而努力 对扩展开放,都修稿关闭 依赖抽象,不要依赖具体类 最少知识原则:之和朋友交谈 好莱坞原则: ...
- python获取指定时间段内的随机不重复的时间点
上篇 <python时间时分秒与秒数的互相转换>http://www.cnblogs.com/gayhub/p/6154707.html 提到了把时间转成秒数的方法, 这篇写写转换成秒数后 ...
- Python的平凡之路(19)
一.Django请求生命周期 对于所有的web框架来说本质就是一个socket服务端,浏览器是socket客户端 ...
- 学习opencv之路(一)
先看一下<学习opencv> 找几个demo 学会相机标定 我做的是单目相机的标定.