摘要: Common Subsequence Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1159DescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = i... 阅读全文
posted @ 2013-07-19 20:39 15HP_EPM测试4_王晓 阅读(109) 评论(0) 推荐(0) 编辑
摘要: Description把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。Input第一行是测试数据的数目t(0 n时,必然有盘子里无法放苹果,这种情况,f(m,n)=f(m,m);当n 2 #include 3 #include 4 #include 5 int f(int m,int n) 6 { 7 if(m==0||n==1) return 1; 8 else if(m>num;17 while(num--)18 {19 cin>>m>>n;20 ... 阅读全文
posted @ 2013-07-19 20:10 15HP_EPM测试4_王晓 阅读(185) 评论(0) 推荐(0) 编辑
摘要: Time Limit:1000MS Memory Limit:30000KB 64bit IO Format:%I64d & %I64u DescriptionYou have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. Because of pending patent issues we will not discuss in detail how t 阅读全文
posted @ 2013-07-16 19:41 15HP_EPM测试4_王晓 阅读(155) 评论(3) 推荐(0) 编辑
摘要: 题目描述:某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路?解题思路:此处涉及到数据结构中的并查集。解题C语言代码: 1#include 2 3 int father[1001]; 4 5 int Find_father(int n) 6 7 { 8 9 if(father[n] != n) father[n]=Find_father(father[n]);1011 return father[n];... 阅读全文
posted @ 2013-07-16 19:25 15HP_EPM测试4_王晓 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 题目描述DescriptionUgly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, ... shows the first 10 ugly numbers. By convention, 1 is included. Given the integer n,write a program to find and print the n'th ugly number.InputEach line of the input c 阅读全文
posted @ 2013-07-15 20:31 15HP_EPM测试4_王晓 阅读(216) 评论(0) 推荐(0) 编辑