上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 36 下一页
摘要: 因为是与运算,所以我们可以贪心地每次找最高位的,将他们加入到新的序列中,然后每一次在这个新的序列继续找下一个位。然后最后序列中任意两个的与运算的值都是一样的且是最大的。#include #include #include #include #include #include #include #in... 阅读全文
posted @ 2014-11-03 18:04 iwtwiioi 阅读(663) 评论(0) 推荐(0) 编辑
摘要: vijos某次模拟赛原题。。。处理出每个圆的一级祖先就行了。。。其实没有那么麻烦,贪心即可出解。我们将每个圆转换成线段后按左端点小右端点大的方法排序然后维护一个栈:对于每一个圆i如果栈顶右端点比圆i的右端点小,则出栈,直到栈空否则i的一级祖先就是栈顶,并且加入i到栈。证明:因为左端点排序,所以问题转... 阅读全文
posted @ 2014-11-03 17:29 iwtwiioi 阅读(612) 评论(1) 推荐(0) 编辑
摘要: 好神的一题。。一开始没想多久就看题解了QAQ。。首先我们发现,这棵树任意两个点的边一定是最小的(即所有其它这两个点的路径都比这条边大,才有可能出解)然后生成树后再算距离判断即可。。注意特判n=1.。。。。。。。。。。。。。。。。。还有出题人一点都不良心。。。说好的0#include #include... 阅读全文
posted @ 2014-11-03 13:49 iwtwiioi 阅读(451) 评论(0) 推荐(0) 编辑
摘要: 这题直接模拟。可是我挂在了最后两个点上QAQ。唯一注意的是注意精度啊。。。用来double后边转成整数就忘记用longlong。。。sad#include #include #include #include #include #include #include #include #include ... 阅读全文
posted @ 2014-11-03 12:10 iwtwiioi 阅读(421) 评论(0) 推荐(0) 编辑
摘要: 好神的一题。。。首先我们只需要枚举这个gcd即可。。从大到小,然后问题转换为判定问题。。。即判定是否有k个数有gcd这个约数。。orz这样做的复杂度最坏是O(n+n/2+n/3+…+n/n)=O(nlnn)的,证明自行Google“调和级数求和”。#include #include #include... 阅读全文
posted @ 2014-11-03 06:21 iwtwiioi 阅读(698) 评论(0) 推荐(0) 编辑
摘要: 直接搜索即可。。。注意不要爆栈。。所以我们可以分块搜索。。。然后太懒且太弱我就不写了。。。orz hzwerhttp://hzwer.com/4954.html【问题描述】moreD和moreD的宠物CD正在玩一个日历游戏,开始时,他们从1900年1月1日到2012年12月22日(你懂的……)选一个... 阅读全文
posted @ 2014-11-02 23:01 iwtwiioi 阅读(758) 评论(0) 推荐(0) 编辑
摘要: 好神的一题。。。这是一道DP题,本题的难点在于状态的确定,由于调整是任意的,很难划分状态,我们略微修改一下调整的形式:把一次’j’和’z’交换看做两次变换:’j’->’z’;’z’->’j’ (zz交换和jj交换是没有意义的,不作考虑);于是最多’j’->'z' 'z'->'j'各K次.F[i,j,... 阅读全文
posted @ 2014-11-02 22:23 iwtwiioi 阅读(853) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1758晕。。。。状压没考虑循环方向然后错了好久。。这点要注意。。。(其实就是01背包变成了完全背包QAQ我们... 阅读全文
posted @ 2014-11-02 20:59 iwtwiioi 阅读(461) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4198约瑟夫变形根据f(n)=(f(n-1)+m)%n因为是求倒数第几个那么我们只要求出f(倒数第几个)的值... 阅读全文
posted @ 2014-11-02 18:57 iwtwiioi 阅读(210) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4140约瑟夫问题。。。。考虑0~n-1编号出第m个即((m%n)-1+n)%n形象地说就是0, 1, ...... 阅读全文
posted @ 2014-11-02 18:16 iwtwiioi 阅读(202) 评论(0) 推荐(0) 编辑
摘要: https://vijos.org/p/1006连边后跑点权的最短路注意连边的时候左端点可以连到下一行的右端点,右端点可以连到下一行的左端点#include #include #include #include #include #include #include #include #include... 阅读全文
posted @ 2014-11-02 16:56 iwtwiioi 阅读(314) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=465&page=show_problem&problem=2399最长的很简单,将串翻转过来后求两个串的lcs就是答案。。主要是字典序那里。。... 阅读全文
posted @ 2014-11-02 16:18 iwtwiioi 阅读(173) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1475正反一次lis然后去min{左,右}*2-1即可#include #include #include ... 阅读全文
posted @ 2014-11-02 15:25 iwtwiioi 阅读(168) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4170d[i,j]前i个字符j结尾d[i,j]=min{d[i-1,k], j和k有边}+(a[i]!=j)... 阅读全文
posted @ 2014-11-02 15:13 iwtwiioi 阅读(264) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=27&page=show_problem&problem=2549设w[i,j]为i-j能分割成的最少回文串f[i]为前i个字符能够分成的最少回... 阅读全文
posted @ 2014-11-02 14:50 iwtwiioi 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 对于这些题我只能说,太神了orz中位数:中位数有个很好的性质,即在直线上所有的点到这些点的中位数的距离和是最小的。例题很多(很多cf的题我都没写在这里了..请看我cf的文章):【vijos】1882 石阶上的砖(中位数+特殊的技巧)【BZOJ】1045: [HAOI2008]糖果传递(中位数)差分:... 阅读全文
posted @ 2014-11-01 06:22 iwtwiioi 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 最近做模拟题看到一些好的题及题解。升格思想:核电站问题 一个核电站有N个放核物质的坑,坑排列在一条直线上。如果连续M个坑中放入核物质,则会发生爆炸,于是,在某些坑中可能不放核物质。 任务:对于给定的N和M,求不发生爆炸的放置核物质的方案总数输入:输入文件只一行,两个正整数N,M(13,那么还需要a[... 阅读全文
posted @ 2014-10-31 18:06 iwtwiioi 阅读(592) 评论(0) 推荐(0) 编辑
摘要: 对于一组多项式方程(增广矩阵中,x[i, n+1]表示式子的值;x[i,j]表示第i个方程第j项的系数,在这里,增广矩阵可能不一定是n个,可能多可能少;opt表示运算规则):(x[1,1]*a[1]) opt (x[1,2]*a[2])opt...opt(x[1,n]*a[n])=x[1, n+1]... 阅读全文
posted @ 2014-10-31 18:03 iwtwiioi 阅读(825) 评论(0) 推荐(0) 编辑
摘要: (写的题真少QAQ动态规划:【vijos】1892 树上的最大匹配(树形dp+计数)【vijos】1770 大内密探(树形dp+计数)noip 模拟赛 After 17(递推+特殊的技巧)【vijos】1757 逆序对(dp)【vijos】1764 Dual Matrices(dp)【vijos】1... 阅读全文
posted @ 2014-10-31 14:20 iwtwiioi 阅读(215) 评论(0) 推荐(0) 编辑
摘要: https://vijos.org/p/1892这个必须得卡评测机+手动开栈才能卡过QAQ手动开栈我百度的。。。int size=256#include #include #include #include #include #include #include #include using name... 阅读全文
posted @ 2014-10-31 07:03 iwtwiioi 阅读(1206) 评论(1) 推荐(0) 编辑
上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 36 下一页