随笔分类 -  回溯

uva387 - A Puzzling Problem
摘要:A Puzzling Problem The goal of this problem is to write a program which will take from 1 to 5 puzzle pieces such as those shown below and arrange them, if possible, to form a square. An example ... 阅读全文

posted @ 2014-08-06 14:29 katago 阅读(329) 评论(0) 推荐(0) 编辑

uva193 - Graph Coloring
摘要:Graph Coloring You are to write a program that tries to find an optimal coloring for a given graph. Colors are applied to the nodes of the graph and the only available colors are black and white. Th... 阅读全文

posted @ 2014-08-05 11:30 katago 阅读(255) 评论(0) 推荐(0) 编辑

uva208 - Firetruck
摘要:Firetruck The Center City fire department collaborates with the transportation department to maintain maps of the city which reflects the current status of the city streets. On any given day, se... 阅读全文

posted @ 2014-08-01 09:02 katago 阅读(335) 评论(0) 推荐(0) 编辑

uva301 - Transportation
摘要:Transportation Ruratania is just entering capitalism and is establishing new enterprising activities in many fields including transport. The transportation company TransRuratania is starting ... 阅读全文

posted @ 2014-07-31 15:20 katago 阅读(460) 评论(0) 推荐(0) 编辑

uva331 - Mapping the Swaps
摘要:Mapping the Swaps Sorting an array can be done by swapping certain pairs of adjacent entries in the array. This is the fundamental technique used in the well-known bubble sort. If we list the id... 阅读全文

posted @ 2014-07-29 10:10 katago 阅读(331) 评论(0) 推荐(0) 编辑

uva10344 - 23 out of 5
摘要:Your task is to write a program that can decide whether you can find an arithmetic expression consisting of five given numbers (1 {1,2,3,4,5} is a bijective functionand {+,-,*} (1#include#include#inc... 阅读全文

posted @ 2014-07-28 13:43 katago 阅读(280) 评论(0) 推荐(0) 编辑

uva216 Getting in Line
摘要:Getting in Line Computer networking requires that the computers in the network be linked. This problem considers a ``linear" network in which the computers are chained together so that each is... 阅读全文

posted @ 2014-07-25 15:38 katago 阅读(246) 评论(0) 推荐(0) 编辑

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) 编辑

< 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

统计

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