摘要: 坦克大战时间限制:1000ms | 内存限制:65535KB难度:3描述Many of us had played the game "Battle city" in our childhood, and some people (like me) even often play it on computer now.What we are discussing is a simple edition of this game. Given a map that consists of empty spaces, rivers, steel walls and brick 阅读全文
posted @ 2013-07-12 09:39 风儿-zsj 阅读(294) 评论(0) 推荐(0) 编辑
摘要: 三点顺序时间限制:1000ms | 内存限制:65535KB难度:3描述现在给你不共线的三个点A,B,C的坐标,它们一定能组成一个三角形,现在让你判断A,B,C是顺时针给出的还是逆时针给出的?如:图1:顺时针给出图2:逆时针给出 输入每行是一组测试数据,有6个整数x1,y1,x2,y2,x3,y3分别表示A,B,C三个点的横纵坐标。(坐标值都在0到10000之间)输入0 0 0 0 0 0表示输入结束测试数据不超过10000组输出如果这三个点是顺时针给出的,请输出1,逆时针给出则输出0样例输入0 0 1 1 1 30 1 1 0 0 00 0 0 0 0 0样例输出01... 阅读全文
posted @ 2013-07-11 09:28 风儿-zsj 阅读(158) 评论(0) 推荐(0) 编辑
摘要: LottoTime Limit:2 Seconds Memory Limit:65536 KBIn a Lotto I have ever played, one has to select 6 numbers from the set {1,2,...,49}. A popular strategy to play Lotto - although it doesn't increase your chance of winning - is to select a subset S containingk(k>6) of these 49 numbers, and then 阅读全文
posted @ 2013-07-08 16:03 风儿-zsj 阅读(179) 评论(0) 推荐(0) 编辑
摘要: The Circumference of the CircleTime Limit:2 Seconds Memory Limit:65536 KBTo calculate the circumference of a circle seems to be an easy task - provided you know its diameter. But what if you don't?You are given the cartesian coordinates of three non-collinear points in the plane.Your job is to c 阅读全文
posted @ 2013-07-07 19:43 风儿-zsj 阅读(265) 评论(0) 推荐(0) 编辑
摘要: 阶乘的0时间限制:3000ms | 内存限制:65535KB难度:3描述计算n!的十进制表示最后有多少个0输入第一行输入一个整数N表示测试数据的组数(1 2 int main() 3 { 4 int n,m; 5 scanf("%d",&n); 6 while(n--) 7 { 8 int sum=0; 9 scanf("%d",&m);10 while(m)11 {12 m/=5;13 sum+=m;14 }15 pr... 阅读全文
posted @ 2013-07-06 17:55 风儿-zsj 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 回文字符串时间限制:3000ms | 内存限制:65535KB难度:4描述所谓回文字符串,就是一个字符串,从左到右读和从右到左读是完全一样的,比如"aba"。当然,我们给你的问题不会再简单到判断一个字符串是不是回文字符串。现在要求你,给你一个字符串,可在任意位置添加字符,最少再添加几个字符,可以使这个字符串成为回文字符串。输入第一行给出整数N(0 2 #include 3 #include 4 using namespace std; 5 int dp[1002][1002]; 6 char a[1002],b[1002]; 7 int len; 8 int min_hui 阅读全文
posted @ 2013-07-06 11:27 风儿-zsj 阅读(282) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 using namespace std; 5 int dp[1002][1002]; 6 char a[1002],b[1002]; 7 int l1,l2; 8 int max_xulie(char *a,char *b) 9 {10 int i,j;11 for(i=1;i<=l1;i++)12 {13 for(j=1;j<=l2;j++)14 {15 if(a[i-1]==b[j-1])16 ... 阅读全文
posted @ 2013-07-05 18:55 风儿-zsj 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #define N 505 4 int map[N][N],in[N],s[N]; 5 int n; 6 int topsort() 7 { 8 int i,j; 9 for(i=1;i<=n;i++)10 {11 for(j=1;j<=n;j++)12 {13 if(map[i][j])14 in[j]++;//查找入度15 }16 }17 for(i=1;i<=n;i++)18 {19 ... 阅读全文
posted @ 2013-07-05 11:25 风儿-zsj 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #define N 50050 4 int s[N]={0},a[N],vis[N]; 5 int hash(int x) 6 { 7 int y=(x%N+N)%N; 8 while(vis[y]&&s[y]!=x) 9 y=(y+1)%N;10 return y;11 }12 int insert(int x)13 {14 int y=hash(x);15 vis[y]=1;16 s[y]=x;17 }18 int find(int x)19 {20 return vis[has... 阅读全文
posted @ 2013-07-05 09:26 风儿-zsj 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 1 //运行文件前在D盘建一个program文件夹 2 #include 3 #include 4 #include 5 #include 6 #include 7 struct student 8 { 9 int num; 10 char name[50]; 11 char sex[20]; 12 int age; 13 char address[50]; 14 char xiyuan[20]; 15 char zhuanye[20]; 16 }stu[1000000]; 17 int cmp(student a,s... 阅读全文
posted @ 2013-06-25 14:15 风儿-zsj 阅读(481) 评论(0) 推荐(0) 编辑