摘要: 题目来源:http://codeforces.com/problemset/problem/112/A Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The 阅读全文
posted @ 2020-07-23 21:49 gdgzliu 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 题目来源: http://codeforces.com/problemset/problem/118/A Petya started to attend programming lessons. On the first lesson his task was to write a simple p 阅读全文
posted @ 2020-07-23 21:31 gdgzliu 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 题目来源: http://codeforces.com/problemset/problem/158/A "Contestant who earns a score equal to or greater than the k-th place finisher's score will advan 阅读全文
posted @ 2020-07-23 20:56 gdgzliu 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 题目来源:http://codeforces.com/problemset/problem/231/A One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programm 阅读全文
posted @ 2020-07-23 18:00 gdgzliu 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://codeforces.com/contest/71/problem/A Sometimes some words like "localization" or "internationalization" are so long that writing them many 阅读全文
posted @ 2020-07-23 17:35 gdgzliu 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 题目 题目分析: trie模板题,稍微需要注意的是,我们这里不仅仅是对字符串结尾进行标记。因为是要统计以某个前缀的个数,因此我们经过一个结点,就给它标记+1,所以最后统计以此为前缀的个数,就是刚好前缀的最后一个字符的标记数。 #include <bits/stdc++.h> using namesp 阅读全文
posted @ 2020-06-08 10:13 gdgzliu 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 题目分析 最基础的trie模板,一开始建立trie,然后逐个查询T,看在trie的路径上,有多少个结束标记,统计个数就是答案。注意本题数据说是MAXN<106, 给定内存空间是64Mb,实际测试MAXN<105。开大了会超内存。 参考代码 #include <bits/stdc++.h> using 阅读全文
posted @ 2020-06-08 09:47 gdgzliu 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 题目分析 详细讲解可参考《一本通.提高篇》p86内容。简单讲就是可以将所有的数字转化成二进制数,因此相当于长度为32的数字字符串,且数字为0和1。对于N个数,我们可以依次把这些数x,插入到trie中,然后我们找出trie中已经存在的某个数(二进制),这个数能与x异或最大。那么怎么才能找到这个最大的数 阅读全文
posted @ 2020-06-02 18:04 gdgzliu 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 1、书本《算法竞赛入门到进阶》P48 2、https://blog.csdn.net/wbin233/article/details/72998375 阅读全文
posted @ 2020-05-27 09:18 gdgzliu 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 给出几种算法的参考代码 1、最朴素的素数判定(试除法) 时间复杂度是O(n) 4、欧拉筛法(线性筛法) 时间复杂度是O(n) 更多资料 1、【素数知识总结】https://blog.csdn.net/u011221820/article/details/78828427 2、【埃氏筛法和欧拉筛法】h 阅读全文
posted @ 2019-12-24 14:59 gdgzliu 阅读(371) 评论(0) 推荐(0) 编辑