沈阳网络赛K-Supreme Number【规律】】的更多相关文章

https://nanti.jisuanke.com/t/31452 题意 给出一个n (2 ≤ N ≤ 10100 ),找到最接近且小于n的一个数,这个数需要满足每位上的数字构成的集合的每个非空子集组成的数字是个素数或1. 分析 打表发现满足要求的数字很少.实际上因为一个数不能出现两次,而偶数不能存在.这样最后只有20个数符合要求. #include <bits/stdc++.h> using namespace std; typedef long long ll; ; ; ] = {,,,…
[传送门]https://nanti.jisuanke.com/t/31452 [题目大意]:给定一个数字(最大可达10100),现在要求不超过它的最大超级质数.超级质数定义:对于一个数,把它看成数字序列 ,如果它的所有子序列形成的数都是质数,那么它就是超级质数. 比如说3137,它的子序列有3,1,7,31,33,37,313,317,137.....由于有一个子序列是33它不是质数,所有3137不是超级质数. [题解]注意,子序列和子串是不同的,子序列包含子串.子序列只要求相对顺序不变,而子…
A prime number (or a prime) is a natural number greater than 11 that cannot be formed by multiplying two smaller natural numbers. Now lets define a number NN as the supreme number if and only if each number made up of an non-empty subsequence of all…
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…
2019-ACM-ICPC-沈阳区网络赛-K. Guanguan's Happy water-高斯消元+矩阵快速幂 [Problem Description] 已知前\(2k\)个\(f(i)\),且\(f(n)=f(n-1)\cdot p(1)+f(n-2)\cdot p(2)+\dots+f(n-k)\cdot p(k)\).求\(f(1)+f(2)+\dots+f(n)\). [Solution] 根据题目条件可知 \[ f(k+1)=f(k)\cdot p(1)+f(k-2)\cdot…
26.89% 1000ms 131072K A prime number (or a prime) is a natural number greater than 11 that cannot be formed by multiplying two smaller natural numbers. Now lets define a number NN as the supreme number if and only if each number made up of an non-emp…
题目链接:https://nanti.jisuanke.com/t/31452 A prime number (or a prime) is a natural number greater than $1$ that cannot be formed by multiplying two smaller natural numbers. Now lets define a number $N$ as the supreme number if and only if each number m…
"Oh, There is a bipartite graph.""Make it Fantastic." X wants to check whether a bipartite graph is a fantastic graph. He has two fantastic numbers, and he wants to let all the degrees to between the two boundaries. You can pick up sev…
One day in the jail, F·F invites Jolyne Kujo (JOJO in brief) to play tennis with her. However, Pucci the father somehow knows it and wants to stop her. There are NN spots in the jail and MM roads connecting some of the spots. JOJO finds that Pucci kn…
odd-even number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Description For a number,if the length of continuous odd digits is even and the length of continuous even digits is odd,we call it odd-even nu…
17.64% 1000ms 131072K   A sequence of integer \lbrace a_n \rbrace{an​} can be expressed as: \displaystyle a_n = \left\{ \begin{array}{lr} 0, & n=0\\ 2, & n=1\\ \frac{3a_{n-1}-a_{n-2}}{2}+n+1, & n>1 \end{array} \right.an​=⎩⎨⎧​0,2,23an−1​−an−…
"Oh, There is a bipartite graph.""Make it Fantastic." X wants to check whether a bipartite graph is a fantastic graph. He has two fantastic numbers, and he wants to let all the degrees to between the two boundaries. You can pick up sev…
Given a rooted tree ( the root is node 11 ) of NN nodes. Initially, each node has zero point. Then, you need to handle QQ operations. There're two types: 1\ L\ X1 L X: Increase points by XX of all nodes whose depth equals LL ( the depth of the root i…
42.93% 1000ms 131072K LATTICE is learning Digital Electronic Technology. He is talented, so he understood all those pieces of knowledge in 10^{-9}10−9 second. In the next 10^{-9}10−9 second, he built a data decoding device that decodes data encoded w…
Lattice's basics in digital electronics 44.08% 1000ms 131072K   LATTICE is learning Digital Electronic Technology. He is talented, so he understood all those pieces of knowledge in 10^{-9}10−9 second. In the next 10^{-9}10−9 second, he built a data d…
题目链接 Problem Description Uncle Mao is a wonderful ACMER. One day he met an easy problem, but Uncle Mao was so lazy that he left the problem to you. I hope you can give him a solution.Given a string s, we define a substring that happens exactly k time…
题目链接 Problem Description Now there are n gems, each of which has its own value. Alice and Bob play a game with these n gems.They place the gems in a row and decide to take turns to take gems from left to right. Alice goes first and takes 1 or 2 gems…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6198 题意:给出一个数k,问用k个斐波那契数相加,得不到的数最小是几. 解法:先暴力打表看看有没有规律. #include <bits/stdc++.h> using namespace std; int dp[2000][2000]; typedef long long LL; int main() { LL c[50]; c[0]=0; c[1]=1; c[2]=1; for(int i=2;…
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…
There are N different kinds of transport ships on the port. The ith kind of ship can carry the weight of V[i]V[i] and the number of the ith kind of ship is 2c[i]-12^{C[i]} - 12. How many different schemes there are if you want to use these ships to t…
gems gems gems Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description Now there are n gems, each of which has its own value. Alice and Bob play a game with these n gems.They place the gems in a row and…
思路见:http://blog.csdn.net/aozil_yang/article/details/77929216. 代码如下: #include <stdio.h> #include <algorithm> #include <string.h> using namespace std; ; typedef long long ll; /** * sa[i]:表示排在第i位的后缀的起始下标 * rank[i]:表示后缀suffix(i)排在第几 * height…
transaction transaction transaction Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 132768/132768 K (Java/Others)Total Submission(s): 1077    Accepted Submission(s): 521 Problem Description Kelukin is a businessman. Every day, he travels arou…
card card card Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1230    Accepted Submission(s): 549 Problem Description As a fan of Doudizhu, WYJ likes collecting playing cards very much. One day…
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=5900 Problem Description Every school has some legends, Northeastern University is the same. Enter from the north gate of Northeastern University,You are facing the main building of Northeastern Universi…
题目:给出1-n连续的方格,从0开始,每一个格子有4个状态,左右脚交替,向右跳,而且每一步的步长必须在给定的区间之内.当跳出n个格子或者没有格子可以跳的时候就结束了,求出游戏的期望步数 0:表示不能到达这个格子 1:表示左脚跳进这个格子 2:表示右脚跳进这个格子 3:随意哪个脚跳进这个格子,而且下一步随意用哪个脚 dp[i][j] :表示走到第 i 个格子在 j 状态的期望. 当j=1时,你可以走到dp[i+k][2],dp[i+k][3], 当j=2时,你可以走到dp[i+k][1],dp[i…
QSC and Master Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Problem Description Every school has some legends, Northeastern University is the same. Enter from the north gate of Northeastern University,You are…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6199 题意:n堆石子,Alice和Bob来做游戏,一个人选择取K堆那么另外一个人就必须取k堆或者k+1堆,两个人都想使用最优策略使得取出的石子的和的差值最大. 解法:http://blog.csdn.net/DorMOUSENone/article/details/77929439 膜大牛 用动态规划的思路来思考,每个人都想最大化自己和另外一个人的差值,其实这个题,完全可以省掉判断是谁的这一维,使得…
题意:给你一棵树,n个点q次操作,操作1查询x子树深度为d的节点权值和,操作2查询子树x权值和 把每个点按(dfn,depth)的二维关系构造kd树,剩下的只需维护lazy标记即可 #include<bits/stdc++.h> #define rep(i,j,k) for(register int i=j;i<=k;i++) #define rrep(i,j,k) for(register int i=j;i>=k;i--) #define erep(i,u) for(regis…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6197 题意:给你n个数,问让你从中删掉k个数后(k<=n),是否能使剩下的序列为非递减或者非递增序列 解法:签到题,就是让你求最长不下降子序列长度len,然后判断下n-len是否小于k(将序列反着存下来然后再求即最长不上升子序列,取两者len中的较大值),然后直接套nlogn的模板即可. #include <bits/stdc++.h> using namespace std; const…