- 博客(16)
- 收藏
- 关注
原创 AtCoder Beginner Contest 221 F - Diameter set
AtCoder Beginner Contest 221 F - Diameter set题意大致解法code题意给定一棵树,找出有多少种点的集合,满足集合内的点两两间的距离均为树的直径。大致解法关键在于树直径的性质:树的所有直径均交与一点所有直径的交点为直径的中点(可能在边上)可以感性的理解下,反证法也很容易证,于是我们可以以这个交点作为树的根,统计下每颗子树有多少叶子的深度是D/2,再统计答案即可,为了防止中点出现在边上,我们可以把边都扩大两倍,这样直径一定的偶数,中点一定是一个点。
2021-10-04 16:24:03
534
4
原创 机器学习中的概率论知识
机器学习中的概率论知识古典概型P(Aˉ)=1−P(A)P(\bar{A}) = 1-P(A)P(Aˉ)=1−P(A)P(A−B)=P(A)−P(AB)P(A-B) = P(A) - P(AB)P(A−B)=P(A)−P(AB)P(A+B)=P(A)+P(B)−P(AB)P(A+B) = P(A)+P(B)-P(AB)P(A+B)=P(A)+P(B)−P(AB)对于一般加法(容斥)条件概率通常把事件 A 的概率 P(A)P(A)P(A)叫做实验前的假设概率,即先验概率 ,如果有另一个事件 B
2021-03-04 21:31:02
217
2
原创 [Codeforces Round #668 (Div. 2)]E. Fixed Point Removal
Codeforces Round #668 (Div. 2)E. Fixed Point Removal ##题意给你一个序列a,若a[i]==ia[i] == ia[i]==i你可以删除a[i]a[i]a[i],删除后前后两部分将重新连接,序列a的权值为他能最多能删除的次数给你q个查询,每个查询给你个x,y,表示将前x个元素和后个元素变为n+1,a的权值变为了多少思路首先我们对原序列分析,要是删除的次数最多,我们肯定是优先删除i大的,口胡证明若a,b位置可删除,a<b,先删除a的会影响a.
2020-09-07 10:45:14
1115
原创 2020牛客多校第二场训练补题记录
2020牛客多校第二场场上解决:C,D,F已补题: A,B,G,H,J,KAll with Pairs字符串题意给你n个字符串,定义f(s,t)f(s,t)f(s,t)表示串s的前缀和t的后缀的最长匹配长度求:∑i=1n∑j=1nf(si,sj)2(mod 998244353)\sum_{i=1}^{n}\sum_{j=1}^{n}f(s_i,s_j)^2(mod\ 998244353)i=1∑nj=1∑nf(si,sj)2(mod 998244353)解法
2020-07-16 09:47:38
275
原创 Codeforces Round #632 (Div. 2)部分题解
A. Little Artem开局天崩构造题,确实不太会构造题。我的做法是黑白砖块交替出现(黑先),判断最后黑的砖块是比白的多1还是相等,若相等则将最后一行的一个白砖比那黑#include<bits/stdc++.h>#define ll long long#define ull unsigned long long#define pb push_back#define l...
2020-04-09 14:37:29
340
原创 牛客 小a的子序列
题目链接链接:https://ac.nowcoder.com/acm/contest/317/F来源:牛客网题目描述小a有一个长度为nn的序列,但是他忘了这个序列的样子,他只记得序列中的数大小在[1, V]内你可以任意选择一些位置,并给它们赋值来组成一段子序列,需要满足序列中的数严格递增一段子序列的“萌值”定义为序列中除最大数外所有数的乘积,若只有1个数则为1他想请你求出所有合法子序...
2019-08-16 20:33:18
252
原创 HDOJ 6659 Acesrc and Good Numbers
题目地址Problem DescriptionAcesrc is a famous mathematician at Nanjing University second to none. Playing with interesting numbers is his favorite. Today, he finds a manuscript when cleaning his room, w...
2019-08-16 11:23:06
220
原创 HDOJ 6651 Final Exam
题目链接Problem DescriptionFinal Exam is coming! Cuber QQ has now one night to prepare for tomorrow’s exam.The exam will be a exam of problems sharing altogether m points. Cuber QQ doesn’t know about t...
2019-08-12 21:24:57
468
1
原创 HDOJ 6624 fraction
题目链接Problem DescriptionMany problems require printing the probability of something. Moreover, it is common that if the answer is ab, you should output a×b−1(modp) (p is a prime number). In these pro...
2019-08-06 11:35:41
142
原创 HDOJ 6620 Just an Old Puzzle
Problem DescriptionYou are given a 4 × 4 grid, which consists of 15 number cells and an empty cell.All numbers are unique and ranged from 1 to 15.In this board, the cells which are adjacent with th...
2019-08-01 13:06:34
241
原创 HDOJ 6623 Minimal Power of Prime
Problem DescriptionYou are given a positive integer n > 1. Consider all the different prime divisors of n. Each of them is included in the expansion n into prime factors in some degree. Required t...
2019-08-01 11:00:32
145
原创 HDOJ 6609 Find the answer
题目链接Problem DescriptionGiven a sequence of n integers called W and an integer m. For each i (1 <= i <= n), you can choose some elements Wk (1 <= k < i), and change them to zero to make ∑...
2019-07-30 18:18:09
233
原创 HDOJ 6608 Fansblog
题目链接Problem DescriptionFarmer John keeps a website called ‘FansBlog’ .Everyday , there are many people visited this blog.One day, he find the visits has reached P , which is a prime number.He thinks...
2019-07-30 12:19:57
248
原创 HDOJ 4810 Wall Painting
Problem DescriptionMs.Fang loves painting very much. She paints GFW(Great Funny Wall) every day. Every day before painting, she produces a wonderful color of pigments by mixing water and some bags of...
2019-07-27 14:39:24
331
原创 HDOJ 4793 Collision
题目链接//http://acm.hdu.edu.cn/showproblem.php?pid=4793Problem DescriptionThere’s a round medal fixed on an ideal smooth table, Fancy is trying to throw some coins and make them slip towards the medal ...
2019-07-26 21:11:58
145
原创 HDOJ 4800 Josephina and RPG
var foo =‘bar’#include<bits/stdc++.h>#define ll long long#define mod 1000003using namespace std;//const double pi=atan(1)*4;int m,n;float t[200][200];int id[10005];int c[11]={0,0,0,1,4,...
2019-07-26 17:34:38
222
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人