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 ...
随机推荐
- React Native 一个组件styles BUG
'use strict'; var React = require('react-native'); var { StyleSheet, PanResponder, View, Text } = Re ...
- Android两个页面之间的切换效果工具类
import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; ...
- iOS 指定圆角个数
需要实现的效果很明确,只要左上和右上两个地方圆角,以前都是通过layer 直接设置四个角都变成圆角,然后我就开始了强大的搜索功能 然后我就获得了我想要的东西 技术链接:http://www.xuebu ...
- 适合PHP学习者的学习路线 10个PHP优化技巧
适合PHP学习者的学习路线: (1) 熟悉HTML/CSS/JS..网页基本元素,完成阶段可自行制作简单的网页,对元素属性相对熟悉 (2) 理解动态语言的概念和运做机制,熟悉基本的PHP语法 (3) ...
- JPA 各种基本用法
查询部分属性 通常来说,都是针对 Entity 类的查询,返回的也是被查询的 Entity 类的实体.J P QL 也允许我们直接查询返回我们需要的属性,而不是返回整个 Entity .在一些 Ent ...
- u-boot学习笔记(一):基础概念
1.U-Boot,全称 Universal Boot Loader,是遵循GPL条款的开放源码项目.U-Boot的作用是系统引导.U-Boot从FADSROM.8xxROM.PPCBOOT逐步发展演化 ...
- Reverse-Daily(5)-RE_100
比较简单的一道题目,主要注意方法一 链接:http://pan.baidu.com/s/1c1U8a4K 密码:cnkq 我用了两种方法 方法一: nop掉几处无关的call指令,然后直接运行程序,但 ...
- calender 软文
http://www.cnblogs.com/cloudgamer/archive/2008/08/23/1274459.html
- NSFileManager计算文件/文件夹大小
在一些软件中,一般都会给用户展现当前APP的内存,同时用户可以根据自己的需要来清除缓存的内容.一般而言,文件夹是没有大小这个属性的,所以需要遍历文件夹的内容来计算文件夹的大小,下面用NSFileMan ...
- github上下载的文件如何在本地运行
最近想学习自己写插件,所以先下载大神写的插件膜拜下,下载下来以后,直接双击运行报错,大神怎么会犯这么低级的错误咧!所以在网上查资料,找到了解决方法. (1)上传到github上面的插件都很规范,文件根 ...