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); } ; }
从今天起,每天一到两题。