无界
If the only tool you have is a hammer, you tend to see every problem as a nail.
BlogJava | 首页 | 发新随笔 | 发新文章 | 联系 | 聚合 | 管理

Telecowmunication (USACO)
  1 import java.io.*;
  2 import java.util.*;
  3 /*
  4 ID:
  5 LANG: JAVA
  6 TASK:telecow
  7 */
  8 public class telecow {
  9     
 10     public static final int WHITE = 0, GRAY = 1, BLACK = 2;
 11     private int[][] flow, capacity, res_capacity;
 12     private int[] parent, color, queue;
 13     private int[] min_capacity;
 14     private int size, source, sink, first, last;
 15     private static int MAXN = 200;
 16     int N,M;
 17     
 18     private int maxFlow()  // Edmonds-Karp algorithm with O(V3E) complexity
 19     {
 20         flow = new int[MAXN][MAXN];
 21         res_capacity = new int[MAXN][MAXN];
 22         parent = new int[MAXN];
 23         min_capacity = new int[MAXN];
 24         color = new int[MAXN];
 25         queue = new int[MAXN];
 26         int max_flow = 0;
 27         for (int i = 0; i < size; i++)
 28             for (int j = 0; j < size; j++)
 29                 res_capacity[i][j] = capacity[i][j];
 30  
 31         while (BFS(source))
 32         {
 33             max_flow += min_capacity[sink];
 34             int v = sink, u;
 35             while (v != source)
 36             {
 37                 u = parent[v];
 38                 flow[u][v] += min_capacity[sink];
 39                 flow[v][u] -= min_capacity[sink];
 40                 res_capacity[u][v] -= min_capacity[sink];
 41                 res_capacity[v][u] += min_capacity[sink];
 42                 v = u;
 43             }
 44         }
 45         return max_flow;
 46     }
 47  
 48     private boolean BFS(int source)  // Breadth First Search in O(V2)
 49     {
 50         for (int i = 0; i < size; i++) {
 51             color[i] = WHITE;
 52             min_capacity[i] = Integer.MAX_VALUE;
 53         }
 54  
 55         first = last = 0;
 56         queue[last++] = source;
 57         color[source] = GRAY;
 58  
 59         while (first != last)  // While "queue" not empty..
 60         {
 61             int v = queue[first++];
 62             for (int u = 0; u < size; u++)
 63                 if (color[u] == WHITE && res_capacity[v][u] > 0)
 64                 {
 65                     min_capacity[u] = Math.min(min_capacity[v], res_capacity[v][u]);
 66                     parent[u] = v;
 67                     color[u] = GRAY;
 68                     if (u == sink) return true;
 69                     queue[last++] = u;
 70                 }
 71         }
 72         return false;
 73     }
 74     
 75     public void done() throws IOException {
 76         BufferedReader f = new BufferedReader(new FileReader("telecow.in"));
 77         PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("telecow.out")));
 78         StringTokenizer st = new StringTokenizer(f.readLine());
 79         N = Integer.parseInt(st.nextToken());
 80         M = Integer.parseInt(st.nextToken());
 81         source = Integer.parseInt(st.nextToken());
 82         sink = Integer.parseInt(st.nextToken());
 83         source--;
 84         sink--;
 85         int osource = source;
 86         int osink = sink;
 87         capacity = new int[N * 2][N * 2];
 88         
 89         //init
 90         for (int i = 0; i < N; i++)
 91             capacity[i * 2][i * 2 + 1] = 1;
 92         
 93         for (int i = 0; i < M; i++) {
 94             st = new StringTokenizer(f.readLine());
 95             int x = Integer.parseInt(st.nextToken());
 96             int y = Integer.parseInt(st.nextToken());
 97             x--;
 98             y--;
 99             capacity[x * 2 + 1][y * 2] = Integer.MAX_VALUE;
100             capacity[y * 2 + 1][x * 2] = Integer.MAX_VALUE;
101         }
102         
103         for (int i = 0; i < 2 * N; i++) {
104             capacity[i][source * 2] = 0;
105             capacity[sink * 2 + 1][i] = 0;
106         }
107         
108         int[] ans = new int[N + 1];
109         
110         size = 2 * N;
111         source = source * 2 + 1;
112         sink = sink * 2;
113         
114         int max = maxFlow();
115         
116         int count = 0;
117         for (int i = 0; i < N; i++)
118             if (i != osource && i != osink) {
119                 capacity[i * 2][i * 2 + 1] = 0;
120                 int nowFlow = maxFlow();
121                 
122                 if (max - nowFlow == count + 1) 
123                     ans[count++] = i;            
124                 else 
125                     capacity[i * 2][i * 2 + 1] = 1;
126             }
127         
128         out.println(max);
129         
130         for (int i = 0; i < count - 1; i++)
131             out.print(ans[i] + 1 + " ");
132         out.println(ans[count - 1] + 1);
133         out.close();
134         
135     }
136     
137     public static void main(String[] args) throws IOException {
138         telecow t = new telecow();
139         t.done();
140         System.exit(0);
141     }
142 }
143
这道题目我自己看出来是最小割的问题,而之前的题目有一道是最小割的

但是有一个不同,这道题是点的最小割,而不是常规的边的最小割

所以这就比较麻烦,需要我们把点转化成边

这就让我想起了之前的那个Fence Loops

我就是把所有的边表示的图转化成了点表示的图,我实在是不想再写那么恶心的算法了。

然后我就去NoCow上面看了一下,果然是有很赞的方法。

具体方法就是,把一个点变成两个点,然后在两个点之间加一条边,并且这条边的权值是1

这样的话,如果割这条边,就相当于去掉了这个点。

剩下的事情就是跟前面的那个Pollute Control差不多了

每次去掉一条边,然后用MaxFlow求一下最大流,如果得出的最大流==最大流-边的权值

那么就证明这条边是最小割。

就这样把所有的最小割找出来,然后就可以了

貌似数据很弱,不像上次的那个Pollute那道题目,还要考虑边的编号的问题的。
posted @ 2009-05-06 14:01 杨磊 阅读(288) | 评论 (0) | 编辑 收藏
 
All Latin Squares (USACO)
一个搜索的题目,不过肯定是要剪枝的

最简单的两个剪枝我想到了

第一个:
首先,第一行已经确定了,那么我们可以把第一列也确定,就按照升序,2,3,4,5……,这样的话,没生成这么一个square,我们就可以随便的去交换除了第一行后面的几行。

他们的一个全排列就对应着一种组合,所以最后的答案乘以N-1的阶乘就可以

第二个:
这个其实是看来的,就是每次只要所搜完N-1行就可以了。因为剩下的一行必然存在一个解。其实这个不难理解的,最后一行的排列顺序只跟前面的每一列缺少的那个数有关。

而且也只能取缺少的那个数,所以也就是唯一的。

第三个:
要用到置换群,我没看懂

尽管之前N次看组合数学里面都说到置换群,但是我还是似懂非懂,问了数学小王子,他也不是非常懂。然后以为这个东西没用,就忽略了。没想到还真的有用。



posted @ 2009-05-02 15:22 杨磊 阅读(403) | 评论 (0) | 编辑 收藏
 
Network of Schools (USACO)
今天终于第一次写了强连通分量的题目

虽然以前老早就知道有这么个东西,对这个东西也有概念,但是确实从来没有写过判别的算法

原来如此简单,但是确实也很巧妙。

在算法导论上面看到的K算法,方法就是做两遍DFS,因为强连通分量有一个性质,就是如果把所有的边反向,那么它仍然是一个强连通分量。

但是今天我用的是Tarjan算法,据说效率比K算法高很多,事实上也应该是这样,因为Tarjan算法只做了一次DFS

其实思想也很简单,就是一直DFS(u),向下向下向下,如果突然发现有一个点可以回到u了,那么这个肯定是一个强连通分量。

哈哈,是不是很通俗。

严格的定义过程大家可以看这里http://www.cmykrgb123.cn/blog/scc-tarjan/

我也是参考了这个才做出来的Tarjan算法,Wiki上的那个过于庞大了,虽然封装的非常好

说说本题,其实就是找强连通分量,然后把每个强连通分量当成一个“超点”来考虑

如果这个“超点”的入度为零,那么它就必然是一个源头,统计这样的“超点”的个数,就是第一问的答案。

第二问,如果有一个“超点”入度不是0,但是出度是0,那就说明这个“超点”可以给其他“超点”作贡献。

我们就找这样的点对,把入度是0和出度是0的点连起来。

这样匹配过后,剩下的要么全是入度是0的,要么全是出度是0的,这些就没办法了,随便从一个连通分量连接过来一条边就可以了。

所以第二问的答案就是所有的“超点”中,入度是0和出度是0的点大的那个数。

  1 import java.io.*;
  2 import java.util.*;
  3 /*
  4 ID: yanglei4
  5 LANG: JAVA
  6 TASK:schlnet
  7 */
  8 public class schlnet {
  9     boolean[] inStack;
 10     int[] DFN;
 11     int[] LOW;
 12     int index = 0;
 13     int[] Stack;
 14     int top = 0;
 15     int[][] map;
 16     int BelongCount = 0;
 17     int[] belong;
 18     
 19     public void Tarjan(int i) {
 20         DFN[i] = LOW[i] = ++index;
 21         inStack[i] = true;
 22         Stack[top++] = i;
 23         for (int j = 1; j <= map[i][0]; j++) {
 24             if (DFN[map[i][j]] == 0) {
 25                 Tarjan(map[i][j]);
 26                 if (LOW[map[i][j]] < LOW[i])
 27                     LOW[i] = LOW[map[i][j]];
 28             }
 29             else if (inStack[map[i][j]] && DFN[map[i][j]] < LOW[i])
 30                 LOW[i] = DFN[map[i][j]];
 31         }
 32         if (DFN[i] == LOW[i]) {
 33             int j = 0;
 34             do {
 35                 j = Stack[--top];
 36                 inStack[j] = false;
 37                 belong[j] = BelongCount;
 38             } while (j != i);
 39             BelongCount++;
 40         }
 41         
 42     }
 43     
 44     public void done() throws IOException {
 45         BufferedReader f = new BufferedReader(new FileReader("schlnet.in"));
 46         PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("schlnet.out")));
 47         int N = Integer.parseInt(f.readLine());
 48         map = new int[N + 1][N + 1];
 49         DFN = new int[N + 1];
 50         LOW = new int[N + 1];
 51         inStack = new boolean[N + 1];
 52         Stack = new int[N + 1];
 53         belong = new int[N + 1];
 54         
 55         Arrays.fill(belong,-1);
 56         for (int i = 1; i <= N; i++) {
 57             StringTokenizer st = new StringTokenizer(f.readLine());
 58             int len = st.countTokens();
 59             map[i][0] = len - 1;
 60             for (int j = 1; j <= len - 1; j++)
 61                 map[i][j] = Integer.parseInt(st.nextToken());    
 62         }
 63         
 64         for (int i = 1; i <= N; i++) {
 65             if (DFN[i] == 0)
 66                 Tarjan(i);
 67         }    
 68         boolean[][] dis = new boolean[BelongCount + 1][BelongCount + 1];
 69         for (int i = 1;i <= N;i++) {
 70             for (int k = 1;k <= map[i][0];k++)
 71                 dis[belong[i] + 1][belong[map[i][k]] + 1] = true;
 72         }
 73         int[] oud = new int[BelongCount + 1];
 74         int[] ind = new int[BelongCount + 1];
 75         
 76         for (int i = 1;i <= BelongCount;i++) {
 77             for (int j = 1; j<= BelongCount;j++) {
 78                 if (i!=j && dis[i][j]) {
 79                     oud[i]++;
 80                     ind[j]++;
 81                 }
 82             }
 83         }
 84         
 85         int i0 = 0;
 86         int o0 = 0;
 87         for (int i = 1;i <= BelongCount;i++) {
 88             if (ind[i] == 0)
 89                 i0++;
 90             if (oud[i] == 0)
 91                 o0++;
 92         }
 93         
 94         if (BelongCount == 1) {
 95             out.println("1");
 96             out.println("0");
 97         }
 98         else {
 99             out.println(i0);
100             out.println(i0>o0?i0:o0);
101         }    
102         out.close();    
103     }
104 
105     public static void main(String[] args) throws IOException {
106         schlnet t = new schlnet();
107         t.done();
108         System.exit(0);
109     }
110 }
111 




posted @ 2009-04-30 20:23 杨磊 阅读(283) | 评论 (0) | 编辑 收藏
 
Big Barn (USACO)
 1 import java.io.*;
 2 import java.util.*;
 3 
 4 /*
 5 ID: yanglei4
 6 LANG: JAVA
 7 TASK:bigbrn
 8 */
 9 public class bigbrn {
10     public static int min(int a, int b) {
11         if (a < b) return a;
12         else return b;
13     }
14     public static int min3(int a, int b, int c) {
15         return min(a, min(b, c));    
16     }
17     public static void main(String[] args) throws IOException {
18         BufferedReader f = new BufferedReader(new FileReader("bigbrn.in"));
19         PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("bigbrn.out")));
20         StringTokenizer st = new StringTokenizer(f.readLine());
21         int N = Integer.parseInt(st.nextToken());
22         int T = Integer.parseInt(st.nextToken());
23         int[][] map = new int[N][N];
24         for (int i = 0; i < T; i++) {
25             st = new StringTokenizer(f.readLine());
26             int x = Integer.parseInt(st.nextToken());
27             int y = Integer.parseInt(st.nextToken());
28             map[x - 1][y - 1] = -1;
29         }
30         
31         for (int i = 0; i < N; i++) {
32             if (map[0][i]!= -1)
33                 map[0][i] = 1;
34             if (map[i][0]!= -1)
35                 map[i][0] = 1;
36         }
37         
38         
39         for (int i = 1; i < N; i++)
40             for (int j = 1; j < N; j++) {
41                 if (map[i][j] != -1) {
42                     int temp = min3(map[i - 1][j], map[i][j - 1], map[i - 1][j - 1]);
43                     if (temp != -1) map[i][j] = temp + 1;
44                     else map[i][j] = 1;
45                 }
46             }
47         
48         int max = 0;
49         for (int i = 0; i < N; i++)
50             for (int j = 0; j < N; j++)
51                 if (map[i][j] != 0 && map[i][j] > max)
52                     max = map[i][j];
53                 
54         out.println(max);
55         out.close();
56         System.exit(0);
57     }
58 }
59 

应该算是一个比较基本的DP吧,状态转移方程也不难想,但是我最开始写成了N^3的了

首先就是用Map[i][j]来表示以i,j为右下角的最大的square的大小

初始化就是第一行,第一列,如果不是#,那么肯定是1

然后对于i,j,我们需要观察i - 1,j - 1,因为是square,所以只跟这个有关

如果在第i行,第j列上面,从当前位置开始,连续map[i-1][j-1]个位置,没有#的话,那么map[i][j] = map[i-1][j-1]+1

我就是在判断连续map[i-1][j-1]这个地方出了问题,我又加了一层循环,所以就变成了N^3的了,然后果然TLE了

这个地方完全没必要用循环一个一个去判断,因为其实你已经有结果了,这个结果就是map[i-1][j]和map[i][j-1]里面小的那个

map[i-1][j]肯定就是从当前位置开始,在第j列上,向上最多可以走多少步不碰到#

因为这时候实际上你已经确定了,#只有可能出现在第i行,第j列上,因为map[i-1][j-1]不是#就保证了这一点

于是,找到两个方向上走的比较近的那个数,如果这个数是小于map[i-1][j-1]的,那么map[i][j]就等于这个数

否则,map[i][j] = map[i-1][j-1]+1

这个地方的重点就是,如果map[i-1][j-1]不是#,那么就保证了#只能在第i行,第j列上面。

只需要检查这两个就可以

然后我们就可以来看map[i-1][j],map[i][j-1],这两个东西其实跟map[i-1][j-1]共享了上面的一块。

如果在第i行,第j列上面出现了#,那么map[i-1][j],map[i][j-1]肯定比map[i-1][j-1]小

否则,我们的square最大也就只能是map[i-1][j-1]+1,因为map[i-1][j-1]已经是以i-1,j-1为右下角最大的square了

于是状态转移方程就是

map[i][j] = min (map[i-1][j],map[i][j-1],map[i-1][j-1]) + 1, map[i][j] != '#'

posted @ 2009-04-30 10:40 杨磊 阅读(183) | 评论 (0) | 编辑 收藏
 
Starry Night (USACO)
     摘要: 绝对,非常考耐心,细心的一道题目,这道题目充分的说明我是考虑问题不全面的人 所以现在看来TopCoder的测试数据还都算是比较弱的,真的没有极其变态的,而且TopCoder的题目其实没有超级复杂的,或许是因为我从来没做过第三题吧。 回正题。 这道题目其实一看就知道怎么做,但是就一个字烦 首先你要用FloodFill把所有的Cluster标注出来,这个不难,而且速度很快,时间...  阅读全文
posted @ 2009-04-28 21:53 杨磊 阅读(484) | 评论 (2) | 编辑 收藏
 
终于到了5.1了,希望能早日做完USACO
发个网络流的标准代码,用的是BFS

外面自己套一个类就行了

capacity自己初始化放进去就可以了

返回值在max_flow里面,有需要的话可以自己改成返回类型的


 1     public static final int WHITE = 0, GRAY = 1, BLACK = 2;
 2     private int[][] flow, capacity, res_capacity;
 3     private int[] parent, color, queue;
 4     private int[] min_capacity;
 5     private int size, source, sink, first, last;
 6     private int max_flow;
 7  
 8     private void maxFlow()  // Edmonds-Karp algorithm with O(V3E) complexity
 9     {
10         flow = new int[size][size];
11         res_capacity = new int[size][size];
12         parent = new int[size];
13         min_capacity = new int[size];
14         color = new int[size];
15         queue = new int[size];
16  
17         for (int i = 0; i < size; i++)
18             for (int j = 0; j < size; j++)
19                 res_capacity[i][j] = capacity[i][j];
20  
21         while (BFS(source))
22         {
23             max_flow += min_capacity[sink];
24             int v = sink, u;
25             while (v != source)
26             {
27                 u = parent[v];
28                 flow[u][v] += min_capacity[sink];
29                 flow[v][u] -= min_capacity[sink];
30                 res_capacity[u][v] -= min_capacity[sink];
31                 res_capacity[v][u] += min_capacity[sink];
32                 v = u;
33             }
34         }
35     }
36  
37     private boolean BFS(int source)  // Breadth First Search in O(V2)
38     {
39         for (int i = 0; i < size; i++)
40         {
41             color[i] = WHITE;
42             min_capacity[i] = Integer.MAX_VALUE;
43         }
44  
45         first = last = 0;
46         queue[last++] = source;
47         color[source] = GRAY;
48  
49         while (first != last)  // While "queue" not empty..
50         {
51             int v = queue[first++];
52             for (int u = 0; u < size; u++)
53                 if (color[u] == WHITE && res_capacity[v][u] > 0)
54                 {
55                     min_capacity[u] = Math.min(min_capacity[v], res_capacity[v][u]);
56                     parent[u] = v;
57                     color[u] = GRAY;
58                     if (u == sink) return true;
59                     queue[last++] = u;
60                 }
61         }
62         return false;
63     }


posted @ 2009-04-28 10:39 杨磊 阅读(190) | 评论 (0) | 编辑 收藏
 
Frame Up
原来这道题目这么简单,记得当年高中的时候做USACO的时候,好像最后就是卡在这道题目上面,然后就是NOIP了

然后我就伤心的告别了NOIP投向了好好学习的怀抱。

今天拿过来看还是没什么思路,然后就去搜了一下解题报告。

其实这个题目无论如何也是要DFS的,因为人家要你输出全部的答案。这样就不用怕了,最多就是剪剪枝。

但是最开始没有想到这一点。

问题就在这个剪枝上,和怎么判断合理的解上面。

方法就是,首先找到每一个Frame的四个角。

然后沿着这个Frame的每条边走一下,如果有其他的字符,就是跟当前Frame不同的字符,那么这个字符肯定是在当前这个字符上层的。

这样就能用一张表来确定上下关系,Above[i][j],表示第i个字符在第j个字符上层

然后就是根据这张表来做一个DFS,这样就可以了。

看了leokan的解题报告,说还要floyd一下。

这样做的目的无非也就是想确定两两之间的上下层关系罢了。

但是似乎没这个必要,直接DFS就可以了。

  1 import java.io.*;
  2 import java.util.*;
  3 /*
  4 ID: yanglei4
  5 LANG: JAVA
  6 TASK:frameup
  7 */
  8 public class frameup{
  9     static char[][] board;
 10     static int[][] pos;
 11     static int[] in;
 12     static int cnt;
 13     static int[][] above;
 14     static char[] answer;
 15     static PrintWriter out;
 16     public static void findAnswer(int step) {
 17         int i,j;
 18         if (step >= cnt) {
 19             for (int k = 0; k < cnt; k++)
 20                 out.print(answer[k]);
 21             out.println();
 22         }
 23         for (i = 0; i < 26; i++) 
 24         if (in[i]> 0) {
 25             for (j = 0; j < 26; j++) 
 26             if (in[j] > 0 && above[i][j] == 1) break;
 27                 
 28               if (j >= 26) { /* no such frame, so this COULD be the next one */
 29                 answer[step] = (char) ('A' + i);
 30                 in[i] = 0; /* mark as in answer */
 31                 findAnswer(step + 1);
 32                 in[i] = 1; /* clear mark */
 33               }
 34 
 35         }
 36     }
 37     public static void main(String[] args) throws IOException {
 38         BufferedReader f = new BufferedReader(new FileReader("frameup.in"));
 39         out = new PrintWriter(new BufferedWriter(new FileWriter("frameup.out")));
 40         StringTokenizer st = new StringTokenizer(f.readLine());
 41         int H = Integer.parseInt(st.nextToken());
 42         int W = Integer.parseInt(st.nextToken());
 43         
 44         board = new char[30][32];
 45         pos = new int[26][4];
 46         in = new int[26];
 47         cnt = 0;
 48         
 49         above = new int[26][26];
 50         answer = new char[27];
 51         
 52         for (int i = 0; i < H; i++) {
 53             String temp = f.readLine();
 54             board[i] = temp.toCharArray();
 55             for (int j = 0; j < W; j++) {
 56                 if (board[i][j] != '.') {
 57                     int loc = board[i][j] - 'A';
 58                     
 59                     if (in[loc] == 0) {//First time met
 60                         in[loc] = 1;
 61                         cnt++;
 62                         pos[loc][0] = pos[loc][2] = i;
 63                         pos[loc][1] = pos[loc][3] = j;
 64                     }
 65                     else {
 66                         if (i < pos[loc][0]) pos[loc][0] = i;
 67                         if (i > pos[loc][2]) pos[loc][2] = i;
 68                         if (j < pos[loc][1]) pos[loc][1] = j;
 69                         if (j > pos[loc][3]) pos[loc][3] = j;
 70                     }
 71                         
 72                 }
 73             }
 74         }
 75         
 76         for (int i = 0; i < 26; i++)
 77             if (in[i] > 0) { /* for each frame */
 78                  for (int j = pos[i][0]; j <= pos[i][2]; j++) { /* check left and right borders */
 79 
 80                    /* left */
 81                    int loc = board[j][pos[i][1]] - 'A';
 82                    if (loc != i) /* there's a different frame where this one should be */
 83                      above[loc][i] = 1; /* that different frame must be above this one */
 84 
 85                    /* right */
 86                    loc = board[j][pos[i][3]] - 'A';
 87                    if (loc != i) /* same as left */
 88                      above[loc][i] = 1;
 89                  }
 90                  for (int j = pos[i][1]; j <= pos[i][3]; j++) { /* check top and bottom */
 91 
 92                    /* top */
 93                    int loc = board[pos[i][0]][j] - 'A';
 94                    if (loc != i)
 95                      above[loc][i] = 1;
 96 
 97                    /* bottom */
 98                    loc = board[pos[i][2]][j] - 'A';
 99                    if (loc != i)
100                      above[loc][i] = 1;
101                  }
102             }
103         
104         findAnswer(0);
105         out.close();
106         System.exit(0);
107     }
108 }
109 


posted @ 2009-04-27 17:07 杨磊 阅读(163) | 评论 (0) | 编辑 收藏
 
UML读书笔记
Principles of Modeling
  1. First, The choice of what models to create has a profound influence on how a problem is attacked and how a solution is shaped.
  2. Second, Every model may be expressed at different levels of precision.
  3. Third, The best models are connected to reality.
  4. Fourth,No single model or view is sufficient. Every nontrivial system is best approached through a small set of nearly independent models with multiple viewpoints.
Three major elements:
  1. the UML's basic building blocks
  2. the rules that dictate how those building blocks may be put together
  3. some common mechanisms that apply throughout the UML
The vocabulary of the UML encompasses three kinds of building blocks:
  1. Things
  2. Relationships
  3. Diagrams
Three kinds of relationships that are most important: dependencies, generalizations, and associations.
  1. Dependencies are using relationships. For example, pipes depend on the water heater to heat the water they carry.
  2. Associations are structural relationships among instances. For example, rooms consist of walls and other things; walls themselves may have embedded doors and windows; pipes may pass through walls.
  3. Generalizations connect generalized classes to more-specialized ones in what is known as subclass/superclass or child/parent relationships. For example, a picture window is a kind of window with very large, fixed panes; a patio window is a kind of window with panes that open side to side.

posted @ 2009-04-26 18:37 杨磊 阅读(206) | 评论 (0) | 编辑 收藏
 
解决Windows 7支付宝问题
先自动下载了新的控件

然后去用这个文件去注册掉那个什么什么CAB

http://www.blogjava.net/Files/LittleDS/800A138F.rar

然后再去下载 xenroll.dll
去 cmd 运行 regsvr32 xenroll.dll

然后就可以了,就可以导入数字证书了。


posted @ 2009-04-25 14:16 杨磊 阅读(171) | 评论 (0) | 编辑 收藏
 
The Primes (USACO)
     摘要: Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->  1 import java.io.*;   2 import java.util.*;  &n...  阅读全文
posted @ 2009-04-24 12:01 杨磊 阅读(216) | 评论 (0) | 编辑 收藏
 
仅列出标题
共10页: 上一页 1 2 3 4 5 6 7 8 9 下一页 Last 
随笔:99 文章:-1 评论:17 引用:0
<2025年8月>
日一二三四五六
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456

留言簿(1)

  • 给我留言
  • 查看公开留言
  • 查看私人留言

随笔分类

  • ACM(43) (rss)
  • Boost(5) (rss)
  • 开发感言(2) (rss)
  • 心情日记(3) (rss)

随笔档案

  • 2009年5月 (12)
  • 2009年4月 (26)
  • 2009年3月 (5)
  • 2009年2月 (7)
  • 2009年1月 (1)
  • 2008年12月 (1)
  • 2008年11月 (4)
  • 2008年10月 (1)
  • 2008年8月 (10)
  • 2008年7月 (1)
  • 2008年6月 (7)
  • 2008年5月 (16)
  • 2008年4月 (3)
  • 2008年3月 (2)
  • 2008年2月 (1)
  • 2007年12月 (1)

相册

  • BlogPicture

搜索

  •  

最新评论

  • 1. re: Boost Thread学习笔记三
  • Mediator的构造函数也许缺少一句如下:
    for ( int i = 0; i < _slotCount; i++ ) _pSlot[i] = NULL;
  • --Harly
  • 2. re: SGU 102
  • 博主这个代码的原理是什么啊?看不大懂欸
  • --lph
  • 3. re: Boost Thread学习笔记五
  • 确实厉害
  • --12
  • 4. re: USACO 终于做完了
  • TOPCODER的数据更坑爹。各种challenge会导致各种刁钻数据都被选手钻研出来了
  • --cot
  • 5. re: 各种话题
  • 评论内容较长,点击标题查看
  • --zvin

Powered by: 博客园
模板提供:沪江博客
Copyright ©2025 杨磊