上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 27 下一页

2016年3月26日

[2016-03-26][632][D][Longest Subsequence]

摘要: 时间:2016-03-26 11:38:31 星期六 题目编号:[2016-03-26][632][D][Longest Subsequence] 题目大意:给定n个数字,求最长子序列,使得它们的lcm最小公倍数小于m #include using namespace std;const int maxn = 1E6 + 10;int cnt[maxn];int a[maxn];int ma... 阅读全文

posted @ 2016-03-26 11:57 红洋 阅读(154) 评论(0) 推荐(0)

[2016-03-26][codeforces][632][B][Alice, Bob, Two Teams]

摘要: 时间:2016-03-26 10:14:35 星期六 题目编号:[2016-03-26][codeforces][632][B][Alice, Bob, Two Teams] 题目大意:给定n段字符串,每段字符串要么都是A,要么都是B,已知每段字符串的长度和字符,问把前k段字符或者后k段字符翻转(A -> B,b -> A,k是任意的),问最多能得到多少个B 分析:先求前n段字符总字符数的前缀和... 阅读全文

posted @ 2016-03-26 11:17 红洋 阅读(98) 评论(0) 推荐(0)

[2016-03-26][codeforces][632][C][The Smallest String Concatenation]

摘要: 时间:2016-03-26 10:32:13 星期六 题目编号:[2016-03-26][codeforces][632][C][The Smallest String Concatenation] 题目大意:给定n个字符串,求把n个字符串拼接起来,使得字符串的字典序最小,输出最后答案 分析:直接排序 排序cmp方法:直接比较 a+b 和 b+a的字典序,小的一定在前面 #include ... 阅读全文

posted @ 2016-03-26 11:17 红洋 阅读(109) 评论(0) 推荐(0)

[2016-03-26][codeforces][632][A][Grandma Laura and Apples]

摘要: 时间:2016-03-25 23:50:29 星期五 题目编号:[2016-03-26][codeforces][632][A][Grandma Laura and Apples] 题目大意:有n的客人,每个客人都来买一半的苹果,如果苹果为奇数,就把多出来的半个苹果送给客人,已知买个客人是否收到更多苹果,问总共应该收到多少元 分析: 最后剩下一个苹果的时候,客人只买半个苹果,送半个苹果,所以最... 阅读全文

posted @ 2016-03-26 11:16 红洋 阅读(139) 评论(0) 推荐(0)

2016年3月25日

[2016-03-19][判断循环-Floyd判圈算法]

摘要: [2016-03-19][判断循环-Floyd判圈算法] Floyd判圈算法的思路 设置两个指针,一个快指针,一个慢指针,快指针每次走两步,慢指针每次走一步,如果快指针能和慢指针相遇,则存在环,,如果快指针先到达终点,则不存在环 LL x1,x2,v = 0; x1 = x2 = 1; //开头值为1,初始化 ... 阅读全文

posted @ 2016-03-25 20:49 红洋 阅读(153) 评论(0) 推荐(0)

[2016-03-25][SGU][455][Sequence analysis]

摘要: 时间:2016-03-25 19:15:59 星期五 题目编号:[2016-03-25][SGU][455][Sequence analysis] 题目大意:给定x0=1,xi+1=(a∗xi−1+xi−1modb)modcx0=1,xi+1=(a∗xi−1+xi−1modb)modc,问第二节循环节的位置 分析:floyd判圈 遇到的问题:可能第一节循环节在2*1e6范围内,但是第二节不在 ... 阅读全文

posted @ 2016-03-25 20:48 红洋 阅读(100) 评论(0) 推荐(0)

2016年3月23日

[2016-03-23][codeforces][580][A][Kefa and First Steps]

摘要: 时间:2016-03-23 13:04:56 星期三 题目编号:[2016-03-23][codeforces][580][A][Kefa and First Steps] 题目大意:求最长上升子串 #include using namespace std;int a[100000 + 100];int main(){ int n; scanf("%d",&n);... 阅读全文

posted @ 2016-03-23 18:36 红洋 阅读(176) 评论(0) 推荐(0)

[2016-03-23][codeforces][560][D][Equivalent Strings]

摘要: 时间:2016-03-23 14:15:39 星期三 题目编号:[2016-03-23][codeforces][560][D][Equivalent Strings] 题目大意:定义两个字符串相等方式,给出两个字符串,问是否相等 分析:递归判断即可 遇到的问题:长度为奇数的字符串一定不相等 #include #include using namespace std;int issame(s... 阅读全文

posted @ 2016-03-23 18:36 红洋 阅读(112) 评论(0) 推荐(0)

[2016-03-23][POJ][3069][Saruman's Army]

摘要: 时间:2016-03-23 18:17:43 星期三 题目编号:[2016-03-23][POJ][3069][Saruman’s Army] 题目大意:在数轴上n个点放半径为r的圆,要求所有点被覆盖,问至少需要多少元 分析:用两个for,第一个for找到圆左边一般能覆盖的点,第二个for求圆后面一般能覆盖的点,这些区域的点放一个圆 #include #include using names... 阅读全文

posted @ 2016-03-23 18:36 红洋 阅读(111) 评论(0) 推荐(0)

[2016-03-23][codeforces][208][A][Dubstep]

摘要: 时间:2016-03-23 00:06:45 星期三 题目编号:[2016-03-23][codeforces][208][A][Dubstep] 题目大意:把字符串中的 “WUB”去掉 #include #include #include using namespace std;int main(){ string str,s; cin>>str; ... 阅读全文

posted @ 2016-03-23 18:35 红洋 阅读(182) 评论(0) 推荐(0)

上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 27 下一页

导航