导航

2013年7月22日

摘要: 点击打开链接吝啬的国度时间限制:1000ms | 内存限制:65535KB难度:3描述在一个吝啬的国度里有N个城市,这N个城市间只有N-1条路把这个N个城市连接起来。现在,Tom在第S号城市,他有张该国地图,他想知道如果自己要去参观第T号城市,必须经过的前一个城市是几号城市(假设你不走重复的路)。输入第一行输入一个整数M表示测试数据共有M(1#include#includetypedef struct CHILD{ int num; struct CHILD * next;}Child;typedef struct NODE { int num; int flag; Child * head; 阅读全文

posted @ 2013-07-22 20:52 勇敢的炮灰 阅读(174) 评论(0) 推荐(0)

摘要: 点击打开链接擅长排列的小明时间限制:1000ms | 内存限制:65535KB难度:4描述小明十分聪明,而且十分擅长排列计算。比如给小明一个数字5,他能立刻给出1-5按字典序的全排列,如果你想为难他,在这5个数字中选出几个数字让他继续全排列,那么你就错了,他同样的很擅长。现在需要你写一个程序来验证擅长排列的小明到底对不对。输入第一行输入整数N(1int haxi[10];int j , k ;int f(int n , int m){ int i; if(n == 0) { printf("%d\n" , m); return 0; } for(i = 1 ; i < 阅读全文

posted @ 2013-07-22 20:46 勇敢的炮灰 阅读(149) 评论(0) 推荐(0)

摘要: 点击打开链接Network of SchoolsTime Limit:1000MSMemory Limit:10000KTotal Submissions:9214Accepted:3654DescriptionA number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a list of schools to which it distributes software (the “receiv 阅读全文

posted @ 2013-07-22 20:32 勇敢的炮灰 阅读(133) 评论(0) 推荐(0)

摘要: 点击打开链接The Triangle时间限制:1000ms | 内存限制:65535KB难度:4描述73 88 1 02 7 4 44 5 2 6 5(Figure 1)Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that starts at the top and ends somewhere on the base. Each step can go either diagonally down to the le 阅读全文

posted @ 2013-07-22 01:39 勇敢的炮灰 阅读(135) 评论(0) 推荐(0)

摘要: 点击打开链接单调递增最长子序列时间限制:3000ms | 内存限制:65535KB难度:4描述求一个字符串的最长递增子序列的长度如:dabdbf最长递增子序列就是abdf,长度为4输入第一行一个整数0#includeint dp[10001];char str[10001];int max;int main(){ int num; scanf("%d" , &num); getchar(); while(num--) { gets(str); int i , j; max = 1; // for(i = 0 ; str[i] ; i++)// dp[i] = 1; 阅读全文

posted @ 2013-07-22 01:31 勇敢的炮灰 阅读(105) 评论(0) 推荐(0)