摘要:Let's consider some math problems. JSZKC has a set A=A={1,2,...,N}. He defines a subset of A as 'Meo set' if there doesn't exist two integers in this
阅读全文
摘要:JSZKC is going to spend his vacation! His vacation has N days. Each day, he can choose a T-shirt to wear. Obviously, he doesn't want to wear a singer
阅读全文
摘要:Alice and Bob are playing a simple game. They line up a row of n identical coins, all with the heads facing down onto the table and the tails upward.
阅读全文
摘要:Method ringing is used to ring bells in churches, particularly in England. Suppose there are 6 bells that have 6 different pitches. We assign the numb
阅读全文
摘要:1 局部数组:没有默认值,如果声明的时候不定义,则会出现随机数(undefined);如果声明的长度与赋值长度不相等,则有,声明的长度>赋值长度,后面用0补足,声明的长度>赋值长度,发生编译错误; 2 3 4 5 全局数组:声明时不赋值,默认值为0 6 在所有函数(包括主函数)之外定义的变量称为“全局变量”。
阅读全文
摘要:#1050 : 树中的最长路 #1050 : 树中的最长路 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 上回说到,小Ho得到了一棵二叉树玩具,这个玩具是由小球和木棍连接起来的,而在拆拼它的过程中,小Ho发现他不仅仅可以拼凑成一棵二叉树!还可以拼凑成一棵多叉树——好吧
阅读全文
摘要:All as we know, a mountain is a large landform that stretches above the surrounding land in a limited area. If we as the tourists take a picture of a
阅读全文
摘要:1 //数据量较小,1000 2 void C() 3 { 4 c[0][0]=1; 5 for(int i=1;in) return 0; 77 ll ans=1ll; 78 for(ll i=1;i a)return 0; 5 return fac[a] * inv[b] % mod * inv[a - b] % mod;...
阅读全文
摘要:改革春风吹满地 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 29045 Accepted Submission(s): 14894 Prob
阅读全文
摘要:In an unprecedented turn of events, goblins recently launched an invasion against the Nedewsian city of Mlohkcots. Goblins—small, green critters—love
阅读全文
摘要:托米没有完成上一个任务,准备施展黑魔法推倒 1317 黑魔法咒语被描述为一个 长为 n 的,仅包含小写英文字母 'a'...'i' 的字符串,在托米所在的星球,魔法造成的每次有效伤害都是来自他的一个子序列,对于每一个 'a'... 'i' 的排列(共 9! 种),若作为咒语的子序列出现, 就会造成
阅读全文
摘要:Ada, Bertrand and Charles often argue over which TV shows to watch, and to avoid some of their fights they have finally decided to buy a video tape re
阅读全文
摘要:1 例如:一个字符串 awbcdewgh 2 3 他的子串: awbc、awbcd、awbcde ...很多个子串 ,但是都是连续在一起 。//substring 4 5 他的子序列:(subsequence ) abc 、abcd、 abcde ... 很多个子序列 ,但是子序列中的字符在字符串中不一定是连在一起的,而是删除其中若干个, 但是子序列一定是单调的(即字符之间ASC...
阅读全文
摘要:1 #include 2 3 int main(void) 4 { 5 int a[5] = {1, 2, 3, 4, 5}, b[5]; 6 /*第一个参数是要保存的位置的起始地址,所以我们直接放b 7 *第二个参数是源数据的起始地址,所以我们把a放上去 8 *第三个参数是要复制的内存块的长度,为a的长度sizeof(a)*/ 9 ...
阅读全文
摘要:You're investigating what happened when one of your computer systems recently broke down. So far you've concluded that the system was overloaded; it l
阅读全文
摘要:1062 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 1062 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Ho最近发现了一个神奇的网站!虽然还不够像58同城那样神奇,但这个网站仍然让小Ho乐在其中,但这是为什么呢? “为什么呢?”小H
阅读全文
摘要:Long long ago, there was an integer sequence a.Tonyfang think this sequence is messy, so he will count the number of inversions in this sequence. Beca
阅读全文
摘要:Problem Description Alice and Bob are playing a game.The game is played on a set of positive integers from 1 to n.In one step, the player can choose a
阅读全文
摘要:1 https://www.cnblogs.com/nysanier/archive/2011/04/19/2020778.html 2 3 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 using namespace ...
阅读全文
摘要:1 https://blog.csdn.net/yuehailin/article/details/68961304 1 #include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 #include <cstring> 5 #in
阅读全文
摘要:Distinct Values Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3105 Accepted Submission(s): 1000
阅读全文
摘要:Maximum Multiple Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1500 Accepted Submission(s): 650
阅读全文
摘要:65536K Let's consider some math problems. JSZKC has a set A=\{1,2,...,N\}A={1,2,...,N}. He defines a subset of AA as 'Meo set' if there doesn't exist
阅读全文
摘要:65536K Persona5 is a famous video game. In the game, you are going to build relationship with your friends. You have NN friends and each friends have
阅读全文
摘要:65536K 动态归化+滚动数组 JSZKC is the captain of the lala team. There are NN girls in the lala team. And their height is [1,N][1,N] and distinct. So it means
阅读全文
摘要:JSZKC is the captain of the lala team. There are NN girls in the lala team. And their height is [1,N][1,N] and distinct. So it means there are no two
阅读全文
摘要:1 https://www.cnblogs.com/linyujun/p/5194184.html a和p互质,a才有关于p的逆元 typedef long long LL;void ex_gcd(LL a, LL b, LL &x, LL &y, LL &d){ if (!b) {d = a, x
阅读全文
摘要:You are given nn strings str1,str2,…,strnstr1,str2,…,strn, each consisting of ( and ). The objective is to determine whether it is possible to permute
阅读全文
摘要:YJJ's Salesman hdu 6447 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1212 Accepted Submission(
阅读全文
摘要:1 1 //强制类型转换 2 2 // https://blog.csdn.net/chaipp0607/article/details/54834954 3 4 double x; 5 int y1,y2; 6 scanf("%lf",&x); 7 y1=int(x); 8 y2=int(round(x)); 9 pri...
阅读全文
摘要:1 // 2018年全国多校算法寒假训练营练习比赛(第三场) 2 // 不凡的夫夫 3 #include <iostream> 4 #include <cstdio> 5 #include <cstring> 6 #include <string> 7 #include <utility> 8 #i
阅读全文
摘要:1 // Coolest Ski Route 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 14 typedef long l...
阅读全文
摘要:Battle Royale games are the current trend in video games and Gamers Concealed Punching Circles (GCPC) is the most popular game of them all. The game t
阅读全文
摘要:Do you like number pyramids? Given a number sequence that represents the base, you are usually supposed to build the rest of the "pyramid" bottom-up:
阅读全文
摘要:Firdaws and Fatinah are living in a country with nn cities, numbered from 11 to nn.Each city has a risk of kidnapping or robbery. Firdaws's home locat
阅读全文
摘要:1 include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 typedef long long ll; 14 #define lowbit(x...
阅读全文
摘要:/* 证明过程如下 :第一种情况:按1到n的顺序上飞机,1会随意选一个,剩下的上去时若与自己序号相同的座位空就坐下去,若被占了就也会随意选一个。求最后一个人坐在应坐位置的概率 */
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 typedef long long ll; 13 #define lowbit(x) (x&(-x)) 1...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 typedef long long ll; 13 #define lowbit(x) (x&(-x)) 1...
阅读全文
摘要:1 //利用二维数组模拟 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 typedef long long ll; 14 #define lowbit...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 14 typedef long long ll; 15 #d...
阅读全文
摘要:1 // 题目链接 http://codeforces.com/contest/1006/problem/C 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include ...
阅读全文
摘要:/ Joy OI / 题目列表 / 最大子序和 / Joy OI / 题目列表 / 最大子序和 / Joy OI / 题目列表 / 最大子序和 / Joy OI / 题目列表 / 最大子序和 / Joy OI / 题目列表 / 最大子序和 题目限制 时间限制 内存限制 评测方式 题目来源 1000m
阅读全文
摘要:128536K E. AC Challenge Dlsj is competing in a contest with n (0 < n \le 20)n(0<n≤20) problems. And he knows the answer of all of these problems. Howe
阅读全文
摘要:// Change of Scenery 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 typedef long long ll; 10 typedef pairP; 11 int n,m,k; 12 con...
阅读全文
摘要:1 // 给你一个有向图,问你最少加几条边能使得该图强连通 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 using namespace std; 12 #define max...
阅读全文
摘要:1 L2-001 紧急救援(25 分) 2 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 typedef pairP; 12 int n,m,s,d; 13 const int N=550; 14 c...
阅读全文
摘要:*/ 1 // German Collegiate Programming Contest 2015 DAG的最小路径覆盖是指找最小数目的互相不相交的有向路径,满足DAG的所有顶点都被覆盖. 首先给出公式:DAG的最小路径覆盖数=DAG图中的节点数-相应二分图中的最大匹配数. DAG的最小路径覆盖是
阅读全文
摘要:1 // Legacy Code 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 14 typedef long long ll; ...
阅读全文
摘要:1 //模数不一定互质,互质才可以用孙子定理。 2 /* 3 https://blog.csdn.net/zmh964685331/article/details/50527894 4 uu遇到了一个小问题,可是他不想答。你能替他解决这个问题吗? 5 问题:给你k对a和r是否存在一个正整数x使每队a和r都满足:x mod a=r,求最小正解x或无解。 6 */ 7 8 #in...
阅读全文
摘要:1 定理一:如果d = gcd(a, b),则必能找到正的或负的整数x和y,使 d = a*x+ b*y。 2 3 定理二:若gcd(a, b) = 1,则方程ax ≡ c (mod b)在[0, b-1]上有唯一解。 4 5 定理三:若gcd(a, b) = d,则方程ax ≡ c (mod b)在[0, b/d - 1]上有唯一解。 6 7 对于a...
阅读全文
摘要:1 const int M=10000; 2 int m=(int)sqrt(M+0.5); 3 bool vis[M]; 4 int pre[M],t; 5 void init() 6 { 7 t=0; 8 memset(vis,0,sizeof(vis)); 9 for(int i=2;i<=m;i++) 10 { 11 if(...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 14 #include 15...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 14 #include 15...
阅读全文
摘要:B. Turn the Rectangles time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output B. Turn the Recta
阅读全文
摘要:1 //hdu 1087 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 #define max(a,b) a>b?a:b 12 typedef long long ll; 13 c...
阅读全文
摘要:1 //Wannafly挑战赛19(牛客网) 2 //A 队列Q 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 int n,m; 10 const int N=1e5+4; 11 int id[N],a[N]; 12 char s[10]; 13 boo...
阅读全文
摘要:1 //hdu 1232 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 typedef long long ll; 12 const int inf=0...
阅读全文
摘要:2^(n-1) x 2^n 2^(n+1) 因为x<2^n,所以2*x<2^(n+1),那么x+y(0<x<y)一定位于 2^(n-1)和2^(n+1)之间。若x+y为2的指数幂,那么必定是2^n.
阅读全文
摘要:// Button Bashing (bfs) 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 using na...
阅读全文
摘要:// 题目链接: https://nanti.jisuanke.com/t/282041 //动态规划,重复利用子问题的最优,来求解当前最优问题 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std; 10 typed...
阅读全文