上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 20 下一页
摘要: 3355: [Usaco2004 Jan]有序奶牛 Description 约翰的N(1≤N≤1500)头牛排成一行挤奶时,有确定的顺序.牛被编成连续的号码1..N,他拥有L条关于奶牛顺序的信息,所有的信息都写成“A在B的前面”这样的形式,而且他知道最后一条是多余的.他觉得,有些冗余信息可以由其他信 阅读全文
posted @ 2017-04-07 21:19 wolf940509 阅读(299) 评论(0) 推荐(0)
摘要: 题目 分析:暴力每句满足条件的打印出来即可 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 using namespace std; 5 int n; 6 int vis[11]; 7 bool judge(int a 阅读全文
posted @ 2017-04-06 21:12 wolf940509 阅读(108) 评论(0) 推荐(0)
摘要: 题目 分析:将先后关系看成边,最后求出字典序最小的拓扑序列 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 #include "string" 5 using namespace std; 6 const int ma 阅读全文
posted @ 2017-04-01 11:33 wolf940509 阅读(170) 评论(0) 推荐(0)
摘要: A题 分析:直接统计装完每一份需要多少个袋子即可 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 using namespace std; 5 const int maxn=100000+10; 6 int a[max 阅读全文
posted @ 2017-03-31 13:32 wolf940509 阅读(145) 评论(0) 推荐(0)
摘要: A题 分析:24进制转换 1 #include<iostream> 2 using namespace std; 3 int main() 4 { 5 int a,b; 6 while(cin>>a>>b){ 7 cout<<(a+b)%24<<endl; 8 } 9 return 0; 10 } 阅读全文
posted @ 2017-03-28 15:22 wolf940509 阅读(173) 评论(0) 推荐(0)
摘要: A题 分析:把多面体和面数一一对应即可 1 #include<iostream> 2 #include<map> 3 #include<cstring> 4 #include<cstdio> 5 using namespace std; 6 int main() 7 { 8 int T; 9 whi 阅读全文
posted @ 2017-03-18 10:11 wolf940509 阅读(82) 评论(0) 推荐(0)
摘要: Problem 分析:我们可以这样考虑,如果一个数在位置(x,y)出现过了,则在第x行,第y列,以及(x,y)所对应的3*3所对应的方格中都不会出现,由此我们用三个数组标记这三个变量,然后在对于没有填数的位置进行dfs即可 1 #include "iostream" 2 #include "cstd 阅读全文
posted @ 2017-03-17 17:13 wolf940509 阅读(96) 评论(0) 推荐(0)
摘要: 题目 分析:很有意思的一个题目,分别以一个数的二进制各位来限制搜索的方向,我们通过对这个数的各位二进制进行判断来决定该方向上是否可以进行深度优先搜索。 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namesp 阅读全文
posted @ 2017-03-16 09:33 wolf940509 阅读(124) 评论(0) 推荐(0)
摘要: 关于线段树的原理学习,可以参看杨弋大牛的论文《线段树》以及刘汝佳老师的《算法竞赛入门经典(训练指南)》,代码风格学习hzwer或者notonlysuccess均可。 一.单点更新 最基础的线段树 题目:codevs1080 链接:http://codevs.cn/problem/1080/ 分析:最 阅读全文
posted @ 2017-03-08 21:36 wolf940509 阅读(159) 评论(0) 推荐(0)
摘要: 我们知道,基础的树状数组只能方便进行单点修改,若要进行区间修改,则树状数组就会有其劣势。所以,我们引入差分思想,来方便进行区间修改(毕竟树状数组还是比线段树好打得多QAQ) 何为差分呢? 现在我们有一个从小到大的数列a[] a 1 3 6 8 9 然后还有一个差分数组b[] b 1 2 3 2 1 阅读全文
posted @ 2017-03-02 14:03 wolf940509 阅读(667) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 20 下一页