Primitive Primes - 题解【数学】】的更多相关文章

题面 It is Professor R's last class of his teaching career. Every time Professor R taught a class, he gave a special problem for the students to solve. You being his favourite student, put your heart into solving it one last time. You are given two pol…
CF1316C [Primitive Primes] 给出两个多项式\(a_0+a_1x+a_2x^2+\dots +a_{n-1}x^{n-1}\)和\(b_0+b_1x+b_2x^2+ \dots +a_{m-1}x^{m-1}\),每个多项式的系数的\(\gcd\)都为1 给出质数\(p\),求在这两个多项式乘积的系数中,任意一个不能被\(p\)整除的系数 比赛的时候没想到,居然了想用线段树维护,什么都想用线段树..然后悲惨掉分 设乘积的系数序列为\(c\) 我们可以设在这两个序列中,第一…
题意:给你两个一元多项式\(f(x)\)和\(g(x)\),保证它们每一项的系数互质,让\(f(x)\)和\(g(x)\)相乘得到\(h(x)\),问\(h(x)\)是否有某一项系数不被\(p\)整除. 题解:这题刚开始看了好久不知道怎么写,但仔细看题目给的条件可能会看出一点门道来,我们知道,\(c_{i}\)是由\(f(x)\)和\(g(x)\)中多个某两项积的和来得到的(\(c_{i}=a_{0}b{i}+a_{1}b_{i-1}+...+a_{i}b_{0}\)),那么我们只要找到第一个不…
数学题 在f(x)和g(x)的系数里找到第一个不是p的倍数的数,然后相加就是答案 为什么? 设x1为f(x)中第一个不是p的倍数的系数,x2为g(x)...... x1+x2前的系数为(a[x1+x2]*b[0]+a[x1+x2-1]*b[1]..)+a[x1]*b[x2]+(.....a[0]*b[x1+x2]) 除了a[x1]b[x2]外,其余的都含有p的倍数,所以和肯定不是p的倍数 #include<bits/stdc++.h> using namespace std; ; int ar…
It is Professor R's last class of his teaching career. Every time Professor R taught a class, he gave a special problem for the students to solve. You being his favourite student, put your heart into solving it one last time. You are given two polyno…
数学期望dp,题面第一次见很吓人,然而从CCF语翻译成人话就简单多了, 开始一般会想到用 f [ i ] [ j ]表示前 i 个课程申请 j 次的期望,然而其实会发现转移的时候还和上一次的情况有关(有某概率取上一次某种情况) 所以用 f [ i ] [ j ] [ 0/1 ]记录这次申请与否,然后枚举每种情况用概率乘一下即可 #include<iostream> #include<cstdio> #include<cstring> #include<algori…
http://poj.org/problem?id=1284 给一个奇质数p,求p的原根数量. 有一个结论:当正整数n存在原根时,其一共有phi(phi(n))个不同余的原根. 所以答案为phi(p-1). #include<algorithm> #include<iostream> #include<cstring> #include<cctype> #include<cstdio> #include<cmath> #include…
Let’s talking about something of eating a pocky. Here is a Decorer Pocky, with colorful decorative stripes in the coating, of length L. While the length of remaining pocky is longer than d, we perform the following procedure. We break the pocky at an…
CodeCraft-20 (Div. 2) A. Grade Allocation 思路 : 无脑水题 代码 #include<iostream> #include<algorithm> #include<vector> using namespace std; const int Len = 1e3 + 5; int ar[Len]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);…
题目描述 给出 $n$ 个数 ,求 $\text{Min}_{x=1}^{\infty}\sum\limits_{i=1}^n(\lfloor\frac {a_i}x\rfloor+a_i\ \text{mod}\ x)$ . $n,a_i\le 10^6$ . 题解 数学 $\text{Min}_{x=1}^{\infty}\sum\limits_{i=1}^n(\lfloor\frac {a_i}x\rfloor+a_i\ \text{mod}\ x)=\sum\limits_{i=1}^n…