CF923E Perpetual Subtraction】的更多相关文章

生成函数好题! 搬一手铃悬的题解(侵删) 现在只需要考虑怎么求出g和逆变换即可,其实也就是对函数F(x)求F(x+1)和F(x-1). 直接二项式定理展开发现是个卷积的形式,大力NTT即可. #include<bits/stdc++.h> #define N 440000 #define eps 1e-7 #define inf 1e9+7 #define db double #define ll long long #define ldb long double using namespac…
[CF932E]Perpetual Subtraction(NTT,线性代数) 题面 洛谷 CF 题解 设\(f_{i,j}\)表示\(i\)轮之后这个数恰好为\(j\)的概率. 得到转移:\(\displaystyle f_{i,j}=\sum_{k=j}^{n}f_{i-1,k}*\frac{1}{k+1}\). 看成生成函数就有\(\displaystyle F_i(x)=\sum_{j=0}^{n}x^j\sum_{k\ge j}\frac{f_{i-1,k}}{k+1}\). 把两维换…
手动博客搬家: 本文发表于20181212 09:37:21, 原地址https://blog.csdn.net/suncongbo/article/details/84962727 呜啊怎么又是数学了啊...数学比例\(\frac{16}{33}=0.4848\) orz yhx-12243神仙 题目链接: https://codeforces.com/contest/947/problem/E 题意: 有一个\([0,n]\)的随机数\(x\)初始为\(i\)的概率为\(p_i\). \(m…
Codeforces 题目传送门 & 洛谷题目传送门 神仙题 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 首先考虑最朴素的 \(dp\),设 \(dp_{z,i}\) 表示经过 \(z\) 次操作后剩下的数为 \(i\) 的概率,那么显然有 \(dp\) 转移方程 \(dp_{z,i}=\sum\limits_{j\ge i}dp_{z-1,j}·\dfrac{1}{j+1}\). 边界条件 \(dp_{0,i}=p_i\) 直接递推显然不行,考虑优化,我们记 \(F_z(x)…
\(\mathcal{Description}\)   Link.   有一个整数 \(x\in[0,n]\),初始时以 \(p_i\) 的概率取值 \(i\).进行 \(m\) 轮变换,每次均匀随机取整数 \(r\in[0,x]\),令 \(x\leftarrow r\).求变换完成后 \(x=i~(i=0..n)\) 的概率.答案模 \(998244353\). \(\mathcal{Solution}\)   令向量 \(\boldsymbol p\) 为此时 \(x\) 的取值概率,显然…
广告 ZJOI2018Round2游记 All Falls Down 非常感谢学弟学妹们捧场游记虽然这是一篇假游记 ZJOI Round1今天正式落下帷幕.在这过去的三天里遇到了很多朋友,见识了很多有趣的人和事.或许这只是我整个OI生涯中的卷首一场,但是允许我谨此游记献给所有的一切.所有的你们. ZJOIday1游记 8:30:然而报告厅里选手们陆陆续续地并没有到齐-- 第一场主讲人是绍一的任轩笛,讲课pdf的标题一如既往地是「杂题选讲」听主讲人说都是一些套路题 Binary Cards 不上升…
1050. String Subtraction (20) Given two strings S1 and S2, S = S1 - S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate S1 - S2 for any given strings. However, it might not be that…
Given a string representing an expression of fraction addition and subtraction, you need to return the calculation result in string format. The final result should be irreducible fraction. If your final result is an integer, say 2, you need to change…
Given a string representing an expression of fraction addition and subtraction, you need to return the calculation result in string format. The final result should be irreducible fraction. If your final result is an integer, say 2, you need to change…
Given a string representing an expression of fraction addition and subtraction, you need to return the calculation result in string format. The final result should be irreducible fraction. If your final result is an integer, say 2, you need to change…