链接 大意: 给定模数$p$, 假设当前在$x$, 则可以走到$x+1$, $x+p-1$, $x^{p-2}$ (mod p), 求任意一条从u到v不超过200步的路径 官方题解给了两个做法, 一个是直接双端搜索, 复杂度大概$O(\sqrt PlogP)$ 还有一种方法是求出两条u->1, v->1长度不超过100的路径, 通过随机生成一个数x, 再对$(ux(mod P), u)$做欧几里得算法 操作2相当于减法, 操作三相当于交换 大概写了下双端搜索 #include <iost…
双向bfs  注意数很大  用map来存 然后各种难受....…
链接 大意:求素因子只含给定素数的第k大数 先二分答案转为判定x是第几大, 然后分两块合并即可, 按奇偶分块可以优化一下常数 #include <iostream> #include <algorithm> #include <cstdio> #include <vector> #define PER(i,a,n) for(int i=n;i>=a;--i) #define REP(i,a,n) for(int i=a;i<=n;++i) #de…
题目链接: http://codeforces.com/gym/100526 http://acm.hunnu.edu.cn/online/?action=problem&type=show&id=11674&courseid=0 题目大意: N个学生M道题(1<=N<=12,1<=M<=30),每道题只有正误两种选项(0 1),每个学生的答题情况和正确题数已知,求标准答案可能有多少种. 如果标准答案只有一种则输出标准答案,否则输出解的个数. 题目思路: […
E - Number Clicker 思路:双向搜索 代码: #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pi acos(-1.0) #define LL long long //#define mp make_pair #define pb push_back #define ls rt<<1, l, m #define rs rt<<1…
uva 6757 Cup of CowardsCup of Cowards (CoC) is a role playing game that has 5 different characters (Mage, Tank, Fighter,Assassin and Marksman). A team consists of 5 players (one from each kind) and the goal is to kill amonster with L life points. The…
Jurassic Remains Paleontologists in Siberia have recently found a number of fragments of Jurassic period dinosaur skeleton. The paleontologists have decided to forward them to the paleontology museum. Unfortunately, the dinosaur was so huge, that the…
Difference Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 62    Accepted Submission(s): 19 Problem Description Little Ruins is playing a number game, first he chooses two positive integers y an…
---恢复内容开始--- J - 中途相遇法 Time Limit:9000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Description   The SUM problem can be formulated as follows: given four lists A, B, C, D<tex2html_verbatim_mark> of integer values, comput…
例题25  侏罗纪(Jurassic Remains, NEERC 2003, LA 2965) 给定n个大写字母组成的字符串.选择尽量多的串,使得每个大写字母都能出现偶数次. [输入格式] 输入包含多组数据.每组数据的第一行为正整数n(1≤n≤24),以下n行每行包含一个大写字母组成的字符串. [输出格式] 对于每组数据,第一行输出整数k,即字符串个数的最大值.第二行按照从小到大的顺序输出选中的k个字符串的编号(字符串按照输入顺序编号为1~n). [样例输入] 6 ABD EG GE ABE…