题目链接 :http://poj.org/problem?id=2472 Description In the movie "Blues Brothers", the orphanage where Elwood and Jack were raised may be sold to the Board of Education if they do not pay 5000 dollars in taxes at the Cook Country Assessor's Office…
题目链接:http://www.icpc.moe/onlinejudge/showProblem.do?problemId=1797 题意是有 n 个点 m 条边,从a到b的不被抓的概率是p,让求从点1到点n的不被抓的最大概率: Dijkstra套一下就可以了,注意初始化: ab到bc不被抓的概率等于ab不被抓的概率乘上bc不被抓的概率: #include <stdio.h> #include <algorithm> #include<string.h> #includ…
最短路问题变形. 题意是给你一些道路,和路过时不被抓的概率. 要求找一条到达目的地时不被抓的最大概率概率. 初始 dis[]设为 1 .其余为 0 .找最大就可以. #include<cstdio> #include<cstring> #include<string> #include<queue> #include<algorithm> #include<map> #include<stack> #include<…
106 miles to Chicago Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 3931   Accepted: 1827   Special Judge Description In the movie "Blues Brothers", the orphanage where Elwood and Jack were raised may be sold to the Board of Educat…
ssworld VS DDD Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1487    Accepted Submission(s): 304 Problem Description One day, sssworld and DDD play games together, but there are some special…
关于有向图走"无限次"后求概率/期望的口胡/[题解]HNCPC2019H 有向图 全是口胡 假了不管 讨论的都是图\(G=(V,E),|V|=n,|E|=m\)上的情况 "走无限次"这个概念很抽象,严谨的证明以及描述和概率的收敛性有关,由于我也不会在此就不讨论这些,但是根据一些概率的知识,可以发现,其实走无限次可以这样描述: 由于使用概率不好描述在无限次的情况时,每个点和点之间的关系,所以用期望.到时候根据期望的定义式反过来求概率.可能的问题是,"不是走无…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1711 问题描述:给两个序列a,b,长度分别为n,m(1<=n<=1000000,1<=m<=10000),问序列b是否为序列a的子序列,若是:返回a中最左边的与b相等的子序列的首元素下标:若不是,输出-1. 目的:方便以后查看KMP算法中next[]的模板 Number Sequence Time Limit: 10000/5000 MS (Java/Others)    Memory…
倍增求lca模板 https://www.luogu.org/problem/show?pid=3379 #include<cstdio> #include<iostream> #include<cmath> #include<cstring> using namespace std; int t,n,cnt,m; int x,y; ][],p,root; ]; ]; ]; ; struct node { int next,to; }e[*]; inline…
整数的阶:设a和n是互素的正整数,使得a^x=1(mod n)成立的最小的正整数x称为a模n的阶 //求阶模板:A^x=1(mod M),调用GetJie(A,M) //输入:10^10>A,M>1 //输出:无解返回-1,有解返回最小正整数x //复杂度:O(M^(0.5)) long long gcd(long long a,long long b) { ) return a; return gcd(b,a%b); } //欧拉函数:复杂度O(n^(0.5)),返回[1,n-1]中所有和n…
Scout YYF I Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6757   Accepted: 1960 Description YYF is a couragous scout. Now he is on a dangerous mission which is to penetrate into the enemy's base. After overcoming a series difficulties,…