Codeforces 518 D Ilya and Escalator】的更多相关文章

Discription Ilya got tired of sports programming, left university and got a job in the subway. He was given the task to determine the escalator load factor. Let's assume that n people stand in the queue for the escalator. At each second one of the tw…
Ilya got tired of sports programming, left university and got a job in the subway. He was given the task to determine the escalator load factor. Let's assume that n people stand in the queue for the escalator. At each second one of the two following…
D. Ilya and Escalator time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Ilya got tired of sports programming, left university and got a job in the subway. He was given the task to determine…
D. Ilya and Escalator time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Ilya got tired of sports programming, left university and got a job in the subway. He was given the task to determine…
CF518D. Ilya and Escalator 题意:n个人,每秒p的概念队首的人进入电梯,求t秒后期望人数 直接使用期望定义 \(f[i][j]\) i秒后电梯中j个人的概率 注意n个人的时候直接\(f[i][n] \rightarrow f[i+1][n]\) #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <cmat…
http://codeforces.com/problemset/problem/518/D 题意:n个人,每秒有p的概率进电梯,求t秒后电梯里人数的期望 考虑dp:f[i][j]代表第i秒有j个人的概率,f[0][0]=1,f[i][j]=f[i-1][j-1]*p+f[i-1][j]*(1-p),特别有:f[i][n]=f[i-1][n]+f[i-1][n-1]*p #include<cstdio> #include<cmath> #include<algorithm&g…
题链: http://codeforces.com/problemset/problem/518/D题解: 期望dp. 定义dp[t][i]表示在第t秒开始之前,已经有了i个人在电梯上,之后期望能有多少人上电梯. 转移: dp[t][i]=(1-P)*dp[t+1][i]+P*(dp[t+1][i+1]+1) 代码: #include<bits/stdc++.h> #define MAXN 2005 using namespace std; int N,T; double P,dp[MAXN]…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Soon a school Olympiad in Informatics will be held in Berland, n schoolchildren will participate there. At a meeting of the jury of the Olympiad…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Ilya is an experienced player in tic-tac-toe on the 4 × 4 field. He always starts and plays with Xs. He played a lot of games today with his fri…
A---Birthday http://codeforces.com/contest/1068/problem/A 题意: 有n种硬币,m个人.m个人要给Ivan送硬币,每个人送的硬币都要互不相同但数量一样.Ivan现在已经有k种了,具体哪k种不知道.现在要求朋友们送的硬币至少有l种是IVan没有的. 思路: 刚开始想的是l/m取上整.后来发现题意是不知道Ivan有的是哪几种,为了保证一定至少l种的话,就需要(l+k)/m取上整. 不可能的情况是人数乘每个人送的硬币数超过n. 用longlong…