06 2017 档案

摘要:链接 分析:暴力枚举1-8位数,并判断是否为素数 1 /* 2 PROB:pprime 3 ID:wanghan 4 LANG:C++ 5 */ 6 #include "iostream" 7 #include "cstdio" 8 #include "cstring" 9 #include "st 阅读全文
posted @ 2017-06-30 18:44 wolf940509 阅读(173) 评论(0) 推荐(0)
摘要:A题 分析:SB题,列一个式子搞定 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "string" 5 using namespace std; 6 long long n,k; 7 int mai 阅读全文
posted @ 2017-06-30 14:18 wolf940509 阅读(117) 评论(0) 推荐(0)
摘要:链接 分析:数字三角形,经典题 1 /* 2 PROB:numtri 3 ID:wanghan 4 LANG:C++ 5 */ 6 #include "iostream" 7 #include "cstdio" 8 #include "cstring" 9 #include "string" 10 阅读全文
posted @ 2017-06-28 10:58 wolf940509 阅读(154) 评论(0) 推荐(0)
摘要:A题 分析:开始从v0开始,每天增加a,然后超过v1就从v1开始 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "string" 5 using namespace std; 6 int c,v0, 阅读全文
posted @ 2017-06-28 09:14 wolf940509 阅读(131) 评论(0) 推荐(0)
摘要:链接 分析:我们用vis[i][j][k]来记录A,B,C三个状态是否被访问过,同时用s[i]来记录C的所有可能值,当i==0时,如果j合法,则标记s[k]=1,最后统计所有为1的s即可 1 /* 2 PROB:milk3 3 ID:wanghan 4 LANG:C++ 5 */ 6 #includ 阅读全文
posted @ 2017-06-27 16:05 wolf940509 阅读(120) 评论(0) 推荐(0)
摘要:链接 分析:首先预处理数据集,然后将数据集排序,我们对于当前位置,去搜索是否存在满足条件的等差数列即可,之前一直TLE,完全是map的锅,太慢了 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "ma 阅读全文
posted @ 2017-06-24 01:41 wolf940509 阅读(188) 评论(0) 推荐(0)
摘要:链接 分析:读题!读题!读题!重要的事说三遍,中文翻译漏掉了一个重要的地方,每个只能用一次,调了一下午还以为标程错了,其实就是找一段长为17的区间,然后使所有都处于这个区间中代价最小,暴力枚举即可。 1 /* 2 PROB:skidesign 3 ID:wanghan 4 LANG:C++ 5 */ 阅读全文
posted @ 2017-06-21 20:06 wolf940509 阅读(250) 评论(0) 推荐(0)
摘要:链接 分析:很有意思的一道题目,本菜调了一下午没有调出来,估计是判环过程出了问题,最后还是参照了官方题解。暴力去求解,首先预处理当前位置出洞以后将会进入的下一个位置,然后用回溯法去枚举每一对组合,在进行判环,这题收获还是很大。 1 /* 2 PROB:wormhole 3 ID:wanghan 4 阅读全文
posted @ 2017-06-20 16:12 wolf940509 阅读(169) 评论(0) 推荐(0)
摘要:链接 分析:卡特兰数,具体请看,注意一下组合数的求法 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "string" 5 using namespace std; 6 const int maxn= 阅读全文
posted @ 2017-06-18 15:50 wolf940509 阅读(92) 评论(0) 推荐(0)
摘要:链接 分析:在无限改之后终于过了,里面要处理的细节比较多,最后可以抽象成字符串,用set来去重 1 /* 2 PROB:combo 3 ID:wanghan 4 LANG:C++ 5 */ 6 #include "iostream" 7 #include "cstdio" 8 #include "c 阅读全文
posted @ 2017-06-17 20:21 wolf940509 阅读(214) 评论(0) 推荐(0)
摘要:链接 分析:经典DP题,最长不下降子序列的变种,同时需要记录路径,用pre[]数组记录当前结点的前一个结点的方法很妙 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "string" 5 #inclu 阅读全文
posted @ 2017-06-17 13:50 wolf940509 阅读(145) 评论(0) 推荐(0)
摘要:链接 分析:当前点的情况仅由其左边和上边的点决定,然后马会走过的点标记一下即可 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "string" 5 using namespace std; 6 co 阅读全文
posted @ 2017-06-17 13:49 wolf940509 阅读(184) 评论(0) 推荐(0)
摘要:A题 分析:注意两个点之间的倍数差,若为偶数则为YES,否则为NO 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "string" 5 #include "cmath" 6 using namesp 阅读全文
posted @ 2017-06-17 10:48 wolf940509 阅读(155) 评论(0) 推荐(0)
摘要:链接 分析:对前半部分求最长上升,对后半部分,求最长下降,二者的最大值即为所求,注意重复的部分 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "string" 5 using namespace s 阅读全文
posted @ 2017-06-15 00:55 wolf940509 阅读(170) 评论(0) 推荐(0)
摘要:链接 分析:这题要求满足最长下降子序列的个数,我们设dp[i]为i位置的最长下降子序列长度,f[i]为i位置对应的个数。考虑j<i,若是满足a[i]==a[j]&&dp[i]==dp[j],我们应该进行去重,这时我们应取后一个位置,因为无论如何,后一个位置所取得的最长下降子序列的长度都不小于前一个位 阅读全文
posted @ 2017-06-14 21:44 wolf940509 阅读(102) 评论(0) 推荐(0)
摘要:链接 分析:对于三位数我们限定为[100,999],两位数我们限定为[10,99],然后我们依次判断是否满足乘法式且各个数位是否在数列中,若都满足+1 1 /* 2 PROB:crypt1 3 ID:wanghan 4 LANG:C++ 5 */ 6 #include "iostream" 7 #i 阅读全文
posted @ 2017-06-13 21:47 wolf940509 阅读(155) 评论(0) 推荐(0)
摘要:链接 分析:我们不断统计相邻两个元素之间的差值,按照差值从大到小排序,在进行贪心即可 1 /* 2 PROB:barn1 3 ID:wanghan 4 LANG:C++ 5 */ 6 #include "iostream" 7 #include "cstdio" 8 #include "cstrin 阅读全文
posted @ 2017-06-10 23:46 wolf940509 阅读(116) 评论(0) 推荐(0)
摘要:链接 分析:水题,按照价格从小到大排序,在进行贪心即可 /* PROB:milk ID:wanghan LANG:C++ */ #include "iostream" #include "cstdio" #include "cstring" #include "string" #include "a 阅读全文
posted @ 2017-06-09 21:52 wolf940509 阅读(147) 评论(0) 推荐(0)
摘要:A Good Set 分析:水题,选奇数即可 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "cmath" 5 using namespace std; 6 //const int maxn=110 阅读全文
posted @ 2017-06-08 16:30 wolf940509 阅读(143) 评论(0) 推荐(0)