会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
blues
Ever tried,ever failed,no matter,try again,fail again,fail better.
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
17
18
19
20
21
22
23
24
25
···
32
下一页
2016年3月10日
POJ 1904 King's Quest 强联通分量+输入输出外挂
摘要: 题意:国王有n个儿子,现在这n个儿子要在n个女孩里选择自己喜欢的,有的儿子可能喜欢多个,最后国王的向导给出他一个匹配。匹配有n个数,代表某个儿子和哪个女孩可以结婚。已知这些条件,要你找出每个儿子可以和哪些女孩结婚 思路:求强联通分量。同时练习一下输入输出外挂可以减少时间 1 #include<cst
阅读全文
posted @ 2016-03-10 11:05 yyblues
阅读(240)
评论(0)
推荐(0)
2016年3月7日
codeforce 651B Beautiful Paintings
摘要: 题意:后一个比前一个大就加一,问最大次数。 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 #include<iostream> 5 #include<cstdlib> 6 #include<string> 7 #incl
阅读全文
posted @ 2016-03-07 23:31 yyblues
阅读(284)
评论(0)
推荐(0)
2016年3月4日
CodeForces 362B Petya and Staircases
摘要: 题意:一个小男孩要上楼梯,他一次可以走1个台阶或2个台阶或3个台阶,但是有一些台阶是脏的,他不想走在脏台阶上。一共有n个台阶和m个脏台阶,他最开始在第1个台阶上,要走到第n个台阶。问小男孩能不能不踩到脏台阶的前提下走到n个台阶。 思路:对于给定的m个脏序列,先排序后,没有连续的三个数就行。 1 #i
阅读全文
posted @ 2016-03-04 23:25 yyblues
阅读(285)
评论(0)
推荐(0)
CodeForces 361B Levko and Permutation
摘要: 题意:有n个数,这些数的范围是[1,n],并且每个数都是不相同的。你需要构造一个排列,使得这个排列上的数与它所在位置的序号的最大公约数满足 > 1,并且这些数的个数恰好满足k个,输出这样的一个排列。 思路:只需要后k个数与下标一样,前n-k个数逆序输出就复合题意。 1 #include<cstdio
阅读全文
posted @ 2016-03-04 23:22 yyblues
阅读(241)
评论(0)
推荐(0)
POJ 3450 Corporate Identity kmp+最长公共子串
摘要: 枚举长度最短的字符串的所有子串,再与其他串匹配。 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 #include<iostream> 5 #include<cstdlib> 6 #include<string> 7 #i
阅读全文
posted @ 2016-03-04 23:17 yyblues
阅读(219)
评论(0)
推荐(0)
HDU 3068 最长回文
摘要: 最长回文串模板题 Manacher 算法 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 #include<iostream> 5 #include<cstdlib> 6 #include<string> 7 #inclu
阅读全文
posted @ 2016-03-04 23:15 yyblues
阅读(197)
评论(0)
推荐(0)
Codeforces Round #344 (Div. 2) A. Interview
摘要: 题意: 给你2*n的矩阵 然后定义一个函数f(a,l,r)表示a数组在l到r的或值 然后让你找到一对l,r,使得f(a,l,r)+f(b,l,r)最大 思路: 直接或所有数 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4
阅读全文
posted @ 2016-03-04 23:12 yyblues
阅读(219)
评论(0)
推荐(0)
Codeforces Round #344 (Div. 2) B. Print Check
摘要: 题意: 给你一个n*m一开始全是0的矩阵,然后又q次询问 每次询问给你三个字母 op,a,b 将第a行变成b 将第a列变成b 然后让你输出Q次询问后,这个矩阵长什么模样 思路:每个格子记录两个状态,区分横竖。 1 #include<cstdio> 2 #include<cstring> 3 #inc
阅读全文
posted @ 2016-03-04 23:10 yyblues
阅读(293)
评论(0)
推荐(0)
2016年3月3日
POJ-3070Fibonacci(矩阵快速幂求Fibonacci数列) uva 10689 Yet another Number Sequence【矩阵快速幂】
摘要: 典型的两道矩阵快速幂求斐波那契数列 POJ 那是 默认a=0,b=1 UVA 一般情况是 斐波那契f(n)=(n-1)次幂情况下的(ans.m[0][0] * b + ans.m[0][1] * a); 1 //POJ 2 #include <cstdio> 3 #include <iostream
阅读全文
posted @ 2016-03-03 20:45 yyblues
阅读(223)
评论(0)
推荐(0)
2016年3月2日
Educational Codeforces Round 9 -- A - Grandma Laura and Apples
摘要: 题意: 外祖母要卖苹果,(有很多但不知道数量),最终所有苹果都卖光了! 有n个人买苹果,如果那个人是half,他就买所有苹果的一半,如果那个人是halfplus,则他买当前苹果数量的一半,Laura还会送半个苹果!问最多能赚多少钱? 思路: 会后一个人一定是halfplus,否则苹果卖不完,所以最后
阅读全文
posted @ 2016-03-02 14:02 yyblues
阅读(275)
评论(0)
推荐(0)
上一页
1
···
17
18
19
20
21
22
23
24
25
···
32
下一页
公告