caioj
文章平均质量分 57
酒酿小河桃
这个作者很懒,什么都没留下…
展开
-
caioj.1097 树状数组
树状数组的基本操作lowbitgetsummy_change#include#include#includeusing namespace std;template void read(T &x){ x=0;int f=1;char ch=getchar(); for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1; for(;原创 2017-09-06 14:32:02 · 190 阅读 · 0 评论 -
caioj1069 顺序对齐
【问题描述】考虑两个字符串右对齐的最佳解法。例如,有一个右对齐方案中字符串是AADDEFGGHC和ADCDEGH。AAD_DEFGGHC ADCDE__GH_ 每一个数值匹配的位置值2分,一段连续的空格值-1分。所以总分是匹配点的2倍减去连续空格的段数,在上述给定的例子中,6个位置(A,D,D,E,G,H)匹配,三段空格,所以得分2*6+(-原创 2017-09-25 18:36:22 · 320 阅读 · 0 评论 -
caioj1068 最长公共子序列LCS
题目描述给出两个字符串 S1 和 S2 求它们最长公共子序列的长度。 什么是最长公共子序列呢? 比如: S1:='abbccdss' S2:='aeebfcaadb' 那么S1和S2的最长公共子序列就是:"abcd". 这个说明最长公共子序列强调位置的前后关系不变,但不在乎是否连续。另外 最长公共子序列不唯一。 输入原创 2017-09-25 14:14:43 · 334 阅读 · 0 评论 -
caioj1064 最长上升子序列
【题意】有n个不相同的整数组成的数列,记为: a(1)、a(2)、……、a(n)例如:3,18,7,14,10,12,23,41,16,24。 上例中挑出:3,18,23,24就是一个长度为4的上升序列,如果挑出: 3,7,10,12,16,24长度为6的上升序列。求出最长的上升序列的长度。【输入格式】第一行一个整数n(1下来n个整数。【输出格式】最长上升原创 2017-09-24 20:11:55 · 244 阅读 · 0 评论 -
caioj.1042 背包搜索
突然想起之前听的 错误的剪枝不如不剪切身体会到了写了一行完全错误的剪枝(仍然没想明白剪枝去掉之后就TLE的很惨改写背包吧wa了两个点蒙被子里哭的特别伤心早上起来订正又颓了很久数数日子快要不到两个月了搜索:#include#include#includeusing namespace std;template void read(T &x原创 2017-09-08 06:57:14 · 223 阅读 · 0 评论 -
caioj.1041 简单的搜索剪枝
一眼最短路问题#includeusing namespace std;template void read(T &x){ x=0;int f=1;char ch=getchar(); for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1; for(;isdigit(ch);ch=getchar())x=(x<<1)+(x<<3)+ch原创 2017-09-07 19:15:25 · 187 阅读 · 0 评论 -
caioj.1040 搜索初步
因为按字典序排序且头尾相接 可理解成是一个圈所以第一位一定是1prim 判断素数的函数里可以加上记忆化因为函数里i*i边写边输出调试比较好可以定义debug函数【雾以及 什么时候要写一下线性筛呀#includeusing namespace std;template void read(T &x){ x=0;int f=1;char ch=getchar()原创 2017-09-07 18:36:29 · 252 阅读 · 0 评论 -
caioj.1039 搜索初步
骑士巡游不清楚为什么跟样例方案不同…玄学等代码能力up后写下A*版本吧#includeusing namespace std;template void read(T &x){ x=0;int f=1;char ch=getchar(); for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1; for(;isdigit(ch);ch=原创 2017-09-07 18:32:03 · 267 阅读 · 0 评论 -
caioj1099 线段树(区间修改+求区间最大值
打模拟赛前写了很多次都不能过下午敲了两遍直接就过了嗯…重学线段树重新做人还是比较后悔上午的暴力分没拿全#include#define maxn 100001using namespace std;template void read(T &x){ x=0;int f=1;char ch=getchar(); for(;!isdigit(ch);ch=getchar())原创 2017-09-23 15:08:03 · 654 阅读 · 0 评论 -
caioj.1038 搜索初步
看输出方式直接懵逼半天…第一反应迭代加深【埃及分数写傻【叹气#includeusing namespace std;template void read(T &x){ x=0;int f=1;char ch=getchar(); for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1; for(;isdigit(ch);ch=getch原创 2017-09-06 21:09:54 · 263 阅读 · 0 评论 -
caioj.1035 搜索初步
非常经典的n皇后问题记得在状压DP中有提到用二进制优化的方法递归:#includeusing namespace std;template void read(T &x){ x=0;int f=1;char ch=getchar(); for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1; for(;isdigit(ch);c原创 2017-09-06 18:49:17 · 423 阅读 · 0 评论 -
caioj.1037 搜索初步
不知道为什么 还是迷宫写的特别顺手 别的搜索都要找很久的bug【雾也许是学搜索的第一题就写的格外顺手的缘故【?以及 全局变量定义了某一变量 又在函数里再次申请相同名字的变量 容易出错定义好变量名!#includeusing namespace std;template void read(T &x){ x=0;int f=1;char ch=getchar(); for(原创 2017-09-06 20:42:26 · 228 阅读 · 0 评论 -
caioj.1036 搜索初步
统计出栈//CATALAN数#includeusing namespace std;template void read(T &x){ x=0;int f=1;char ch=getchar(); for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1; for(;isdigit(ch);ch=getchar())x=(x<<1)+(x<<原创 2017-09-06 20:10:46 · 218 阅读 · 0 评论 -
caioj.1034 搜索初步
二叉树的后序遍历#includeusing namespace std;template void read(T &x){ x=0;int f=1;char ch=getchar(); for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1; for(;isdigit(ch);ch=getchar())x=(x<<1)+(x<<3)+ch-'0原创 2017-09-06 18:38:48 · 432 阅读 · 0 评论 -
caioj.1033 搜索初步
生成全排列+判素数判素数%手癌写成了& debug了五分钟静态差错比较重要啊#includeusing namespace std;template void read(T &x){ x=0;int f=1;char ch=getchar(); for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1; for(;isdigit(ch);原创 2017-09-06 15:55:46 · 169 阅读 · 0 评论 -
caioj.1032 搜索初步
生成组合数#includeusing namespace std;template void read(T &x){ x=0;int f=1;char ch=getchar(); for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1; for(;isdigit(ch);ch=getchar())x=(x<<1)+(x<<3)+ch-'0';原创 2017-09-06 15:34:00 · 215 阅读 · 0 评论 -
caioj.1031 搜索初步
生成全排列#includeusing namespace std;template void read(T &x){ x=0;int f=1;char ch=getchar(); for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1; for(;isdigit(ch);ch=getchar())x=(x<<1)+(x<<3)+ch-'原创 2017-09-06 15:28:01 · 251 阅读 · 0 评论 -
luogu2955 [USACO09OCT]奇数偶数Even? Odd?
题目描述Bessie's cruel second grade teacher has assigned a list of N (1 <= N <= 100) positive integers I (1 <= I <= 10^60) for which Bessie must determine their parity (explained in second grade as 'E原创 2017-09-28 07:04:23 · 605 阅读 · 0 评论