02 2018 档案
摘要:模板:http://www.cnblogs.com/TQCAI/p/8410799.html 1.高精度加法训练 #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <string.h
        阅读全文
                
摘要:刚开始直接拿set录数据做,以为是个水题,没想到WA了,只得了12分 WA代码: #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <string.h> #include <vect
        阅读全文
                
摘要:bfs,需要注意用set记录走过的局面,我用的是set<string> condition,看其他人的博客有用set<string> visited 的,变量名起得更加贴切 只要注意这个点,细心一点就可以AC了
        阅读全文
                
摘要:字符串处理,采用递归的方法 需要注意的是最后两个测试数据的括号是不匹配的,这要求我们在proc函数处理完之后,如果tmp(记录括号的字符串变量)的size大于0时,直接把tmp拉进去递归
        阅读全文
                
摘要:记录好缺少部分的坐标,用next_permutation进行穷举,就可以得到答案了
        阅读全文
                
摘要:这题想了一个小时,也只得了66分,并且是一道看起来很简单的题…… 贴出代码,留给日后的自己
        阅读全文
                
摘要:#include using namespace std; void scan(__int128 &x)//输入 { x = 0; int f = 1; char ch; if((ch = getchar()) == '-') f = -f; else x = x*10 + ch-'0'; while((ch = getchar()) >=...
        阅读全文
                
摘要:用前缀和来求区间和,然后用一个二重循环穷举,但是因为问题规模为100000,所以超时(28分) 超时代码: #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <string.h> #
        阅读全文
                
摘要:扩展欧几里得+完全背包 87分代码: #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <string.h> #include <vector> #include <set> #in
        阅读全文
                
摘要:证明链接:http://blog.csdn.net/acmore_xiong/article/details/47694909 模板: 一、求解不定方程 1.青蛙的约会 题意: 本题其实是在求不定方程的解。根据题设条件,我们其实是需要找到一个整数p,使方程 (x+p·m)%L=(y+p·n)%L 有
        阅读全文
                
摘要:最大公约数: 递归代码: gcb的两个重要结论: 最小公倍数:
        阅读全文
                
摘要:调用方法: 测试效果: 注:可以看到1 2 3 4这个结果被跳过了。 正确调用方法:
        阅读全文
                
摘要:OJ链接:http://lx.lanqiao.cn/problem.page?gpid=T443 模拟题,但是我走入了误区,导致开始出错。 代码:
        阅读全文
                
摘要:oj链接:http://lx.lanqiao.cn/problem.page?gpid=T125 水题
        阅读全文
                
摘要:OJ链接:http://lx.lanqiao.cn/problem.page?gpid=T126 如果能理解其内在的含义,可以得40分保命: 保命代码: #include <stdio.h> #include <memory.h> #include <math.h> #include <string
        阅读全文
                
摘要:1.元素序列的排列与组合 组合序列: 递归图解: 全排列: 将组合后的序列进行全排列,就得到了排列序列: 排列序列: 测试代码: #include <stdio.h> #include <memory.h> #include <math.h> #include <string.h> #include
        阅读全文
                
摘要:高斯消元法 模板: 完整代码: #include <stdio.h> #include <memory.h> #include <math.h> #include <string.h> #include <string> #include <vector> #include <set> #inclu
        阅读全文
                
摘要:模板: 1.负数的进制 #include <stdio.h> #include <memory.h> #include <math.h> #include <string.h> #include <string> #include <vector> #include <set> #include <
        阅读全文
                
摘要:模板: 示意图: 1.Ultra-QuickSort 大佬代码: //树状数组 #include<iostream> #include<string.h> #include<algorithm> using namespace std; #define MAX 500010 int c[MAX]; 
        阅读全文
                
摘要:1.最大数 代码: #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vector> #include <set> #include <stack> #include <queue
        阅读全文
                
摘要:王道P38T20 主代码: 完整代码: #include <cstdio> #include <stdlib.h> using namespace std; typedef struct DNode{ int data,freq; struct DNode* next=NULL; struct DN
        阅读全文
                
摘要:王道P38T19 代码: 完整代码: #include <cstdio> #include <stdlib.h> using namespace std; typedef struct LNode{ int data; struct LNode* next=NULL; LNode(int x=0){
        阅读全文
                
摘要:王道P39T17 主代码: 完整代码: #include <cstdio> #include <stdlib.h> using namespace std; typedef struct DNode{ int data; struct DNode* next=NULL; struct DNode* 
        阅读全文
                
摘要:王道P38T16 代码: 主代码: #include <cstdio> #include <stdlib.h> using namespace std; typedef struct LNode{ int data; struct LNode* next=NULL; LNode(int x=0){ 
        阅读全文
                
摘要:王道P38T14 主代码: 完整代码: #include <cstdio> #include <stdlib.h> using namespace std; typedef struct LNode{ int data; struct LNode* next=NULL; LNode(){ } LNo
        阅读全文
                
摘要:王道P38T13 主代码: 完整代码: #include <cstdio> #include <stdlib.h> using namespace std; typedef struct LNode{ int data; struct LNode* next=NULL; LNode(){ } LNo
        阅读全文
                
摘要:王道P37T12 主代码: 完整代码: #include <cstdio> #include <stdlib.h> using namespace std; typedef struct LNode{ int data; struct LNode* next=NULL; LNode(){ } LNo
        阅读全文
                
摘要:1.维护区间最大最小值模板(以维护最小值为例) 2.维护区间和的模板 数据结构: 建树: 单点修改: 单点查询: 区间修改: 区间查询: 3.模板编写练习:
        阅读全文
                
摘要:理论分析 尼姆博弈模型,大致上是这样的: 有3堆各若干个物品,两个人轮流从某一堆取任意多的物品,规定每次至少取1个,多者不限,最后取光者得胜。 分析 1、首先自己想一下,就会发现只要最后剩两堆物品一样多(不为零),第三堆为零,那面对这种局势的一方就必败 那我们用(a,b,c)表示某种局势,首先(0,
        阅读全文
                
摘要:理论分析 问题:首先有两堆石子,博弈双方每次可以取一堆石子中的任意个,不能不取,或者取两堆石子中的相同个。先取完者赢。 分析:首先我们根据条件来分析博弈中的奇异局势 第一个(0 , 0),先手输,当游戏某一方面对( 0 , 0)时,他没有办法取了,那么肯定是先手在上一局取完了,那么输。 第二个(1,
        阅读全文
                
摘要:问题描述: 有一堆物品,共n个,两人轮流从这堆物品中取,规定每次至少取一个,至多m个,获胜条件分为两种,分别是最后取光者胜或者是最后取光者败。 情形一:最后取光者胜 分析: 若n=m+1,则无论先手取走多少,后手一定可以一次性取走剩下的全部物品,这时后手胜; 若n=(m+1)*r+s,且s<=m,r
        阅读全文
                
摘要:1.三国游戏(完全信息静态博弈) 代码: #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vector> #include <set> #include <stack> #inc
        阅读全文
                
摘要:1.TOYS 双语描述: Calculate the number of toys that land in each bin of a partitioned toy box. 计算一个分区玩具箱每个箱子里的玩具数量。 Mom and dad have a problem - their chil
        阅读全文
                
摘要:1.最大正方形 我的瞎猜分析: 我的瞎猜算法: #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vector> #include <set> #include <stack> #
        阅读全文
                
摘要:memset可以对高位数组进行初始化,非常方便。需要注意的是memset的头文件是string.h和memory.h 。 下面来谈memset的4个使用技巧: (注:一下dp高维数组都是全局变量,局部变量请自行修改sizeof语句) 1. 用memset赋 0 2. 用memset赋 -1 在计算机
        阅读全文
                
摘要:在编码中,有时候要求当前的一个bool变量是true,但是随后要对他取反成false。一般我们用 这样的语句来实现。但是今天我想到了一个更加好的办法,请看代码和测试: 代码: 测试结果: 我们用int类型代替bool进行逻辑判断,计算机的数据用补码表示,int的-1就是0xFFFFFFFF,用取反符
        阅读全文
                
摘要:1.数字三角形 学习链接:http://blog.csdn.net/zwhlxl/article/details/46225947 输入样例: 输出样例: 递归代码: #include <stdio.h> #include <memory.h> #include <math.h> #include 
        阅读全文
                
摘要:1.尼克的任务 #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vector> #include <set> #include <stack> #include <queue> 
        阅读全文
                
摘要:1.直线取石子 #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vector> #include <set> #include <stack> #include <queue> 
        阅读全文
                
摘要:代码: #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vector> #include <set> #include <stack> #include <queue> #inc
        阅读全文
                
摘要:实现源码:https://www.cnblogs.com/cobbliu/archive/2012/05/21/2512249.html 1.在一个递增的数组(或vector)中查找元素属于[ s , e ) 的下标 2.查找递增数组中元素是否存在 使用binary_search 注: 对于结构体,
        阅读全文
                
摘要:1.最长公共子序列 参考博客: http://blog.csdn.net/hrn1216/article/details/51534607 http://blog.csdn.net/u013074465/article/details/45392687 代码: #include <stdio.h> 
        阅读全文
                
摘要:1.P1060 开心的金明 https://www.luogu.org/problemnew/solution/P1164 #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vec
        阅读全文
                
摘要:公共部分 定义了高精度数据结构“hp”,并且定义了输入(构造函数),输出(print),以及初始化(默认构造函数),隐藏了部分细节。 并且hp内部存储的数据是真实数据的逆序,但是在输入和输出的时候自动换序 高精度乘高精度 代码: 代码理解: 这是一段相当精简的代码,非常有利于程序员记忆。我昨天还在学
        阅读全文
                
摘要:OJ链接:https://www.patest.cn/contests/pat-a-practise/1119 我的分析过程:pat1119分析.pdf 参考博客:https://www.cnblogs.com/xiongmao-cpp/p/6498672.html 实现代码: 完整代码: #inc
        阅读全文
                
摘要:使用的全局变量: 根据前序、中序生成后序: 根据后序、中序生成前序: 完整代码: #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vector> #include <set> #
        阅读全文
                
 
                     
                    
                 
                    
                
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号