06 2014 档案

uva140 - Bandwidth
摘要:Bandwidth Given a graph (V,E) where V is a set of nodes and E is a set of arcs in VxV, and an ordering on the elements in V, then the bandwidth of a node v is defined as the maximum distance in ... 阅读全文

posted @ 2014-06-24 15:20 katago 阅读(1959) 评论(0) 推荐(3) 编辑

uva129 - Krypton Factor 7.4.3 困难的串
摘要:7.4.3困难的串 学习点:dfs加入返回值,递归搜索过程中如果有一个成功,就直接退出 //7.4.3 困难的串#include#include#include#include#includeusing namespace std;int n,L;int cnt;char v[81];bool judge(int cur){ for(int i=1;i>n>>L) { ... 阅读全文

posted @ 2014-06-18 11:28 katago 阅读(978) 评论(0) 推荐(0) 编辑

uva167 - The Sultan's Successors
摘要:题意:八皇后问题的扩展。8*8棋盘上每个格子都有一个整数,要求8个皇后所在格子的数字之后最大 解法一,回溯: 用vis数组记录 列,主对角(y-x), 副对角(y+x) 访问情况 #include#include#include#include#includeusing namespace std;int C[50], vis[3][50], tot = 0, n = 8, nc... 阅读全文

posted @ 2014-06-16 17:23 katago 阅读(307) 评论(0) 推荐(0) 编辑

位运算简介及实用技巧(一):基础篇
摘要:http://www.matrix67.com/blog/archives/263 位运算简介及实用技巧(一):基础篇 去年年底写的关于位运算的日志是这个Blog里少数大受欢迎的文章之一,很多人都希望我能不断完善那篇文章。后来我看到了不少其它的资料,学习到了更多关于位运算的知识,有了重新整理位运算技巧的想法。从今天起我就开始写这一系列位运算讲解文章,与其说是原来那篇文章的follow-... 阅读全文

posted @ 2014-06-13 17:36 katago 阅读(3707) 评论(0) 推荐(0) 编辑

UVa11218 KTV
摘要:// Rujia Liu // 题意:给出n个带权集合,每个集合包含1~9中的三个整数。找出其中三个集合,使得1~9恰好各出现一次,且权和最大 // 算法:暴力n^2枚举前两个集合,直接计算出第三个集合。用位运算让代码更简单,速度也更快 学习点: 1、全集ALL为(1#include#includeusing namespace std;const int maxn = 1000 +... 阅读全文

posted @ 2014-06-13 16:09 katago 阅读(238) 评论(0) 推荐(0) 编辑

counting sort 计数排序
摘要://counting sort 计数排序//参考算法导论8.2节#include#include#include#includeusing namespace std;const int k=5;const int n=7;int a[n]={5, 5, 1, 2 , 5, 4, 1};int b[n];int c[k+1];int main(){ int maxn=0; mem... 阅读全文

posted @ 2014-06-11 10:19 katago 阅读(322) 评论(0) 推荐(0) 编辑

Uva10474 - Where is the Marble?
摘要:两种解法: 1.计数排序 //计数排序#include#include#include#includeusing namespace std;const int maxn=10001;int v[maxn], s[maxn];int main() { int N, Q; int Kase=0; while(cin>>N>>Q && N && Q) { ... 阅读全文

posted @ 2014-06-10 16:46 katago 阅读(154) 评论(0) 推荐(0) 编辑

Uva110 Meta-Loopless Sorts
摘要:Meta-Loopless Sorts Background Sorting holds an important place in computer science. Analyzing and implementing various sorting algorithms forms an important part of the education of most comput... 阅读全文

posted @ 2014-06-10 15:22 katago 阅读(282) 评论(0) 推荐(0) 编辑

Uva592 Island of Logic
摘要:题意:神人鬼三个种族,神只说真话,鬼只说假话,人白天说真话,晚上说假话。根据对话内容区分种族和白天黑夜。 最多有A, B, C, D, E五个人 算法:枚举A, B, C, D, E的种族情况和白天黑夜的情况。每个人有可能是神人鬼,所以用两个bit表示,白天黑夜用1个bit表示。一共需要11 bits. #include#include#includeusing names... 阅读全文

posted @ 2014-06-09 15:18 katago 阅读(308) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示