ICPC 沈阳 Problem C】的更多相关文章

题意 求n的全排列中将前k个数排序后最长公共子序列>=n-1的个数 思考 我们先把最后可能产生的结果找出来,再找有多少种排列能构成这些结果 设排列为s S like 1,2,3,...,n , 个数=1 S like 1,2,3, ... i-1, j, i, ... j-1, j+1, ...n 当j<=k时不存在 当j>k时, 个数= (j-1)-k+1=j-k 综上,个数=\(\Sigma_{j=k+1}^{n}j-k\) S like 1,2,3,...i-1, i+1, ..j…
2018 ICPC 沈阳网络赛 Call of Accepted 题目描述:求一个算式的最大值与最小值. solution 按普通算式计算方法做,只不过要同时记住最大值和最小值而已. Convex Hull 题目描述:定义函数\(gay(x)\),若\(x\)是某个非\(1\)的数的平方的倍数,则\(gay(x)=0\),否则\(gay(x)=x^2\),求\(\sum_{num=1}^{n} ( \sum_{i=1}^{num} gay(x) ) mod p\) solution \[\sum…
cable cable cable Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 278    Accepted Submission(s): 224 Problem Description Connecting the display screen and signal sources which produce different…
Recursive sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1525    Accepted Submission(s): 710 Problem Description Farmer John likes to play mathematics games with his N cows. Recently,…
Consider a un-rooted tree T which is not the biological significance of tree or plant, but a tree as an undirected graph in graph theory with n nodes, labelled from 1 to n. If you cannot understand the concept of a tree here, please omit this problem…
Problem Similar to the strange ability of Martin (the hero of Martin Martin), Ghh will random occurrence in one of \(N\) cities every morning and the money will change to \(X\) RMB (No matter how much money had yesterday). Ghh finds that every \(N\)…
题目链接 #include <map> #include <queue> #include <math.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <algorithm> #include <iostream> using namespace std; ]; ; long long quick(long long…
题目链接 题意:一个数字,它每个数位上的奇数都形成偶数长度的段,偶数位都形成奇数长度的段他就是好的.问[L , R]的好数个数. 题解:裸的数位dp, 从高到低考虑每个数位, 状态里存下到当前位为止的值的奇偶性和长度奇偶性即可. #include <iostream> #include <vector> #include <string.h> #include <stdio.h> #include <queue> using namespace…
题目链接 题意:求[1,n]有多少个素数,1<=n<=10^11.时限为6000ms. 官方题解:一个模板题, 具体方法参考wiki或者Four Divisors. 题解:给出两种代码. 第一种方法Meisell-Lehmer算法只需265ms. 第二种方法不能运行但是能AC,只需35行. 第一种: //Meisell-Lehmer #include<cstdio> #include<cmath> using namespace std; #define LL long…
铜铜铜…… 人呐真奇怪 铁牌水平总想着运气好拿个铜 铜牌水平总想着运气好拿个银 估计银牌的聚聚们一定也不满意 想拿个金吧 这次比赛挺不爽的 AB两道SB题,十分钟基本全场都过了 不知道出这种题有什么意思,而且还是两道 C是一道矩阵快速幂 不算难可是还是卡了很久 还好是1A E是一道搜索题,也是简单题 呵呵 可能是区域赛的问题 大家都不敢随便写吧 后来我们暴力过了的时候都觉得自己好SB 那个时候都快封榜了 怎么这么蠢呐 然后看的H题,其他题做出来的都很少,没怎么想 H题 哎 我们想了好久才想明白样…