摘要:
Problem DescriptionAngel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M <= 200) matrix. There are WALLs, ROADs, and GUARDs in the prison.Angel's friends want to save Angel. Their task is: approach Angel. We assume that "approach Angel 阅读全文
随笔档案-2012年03月
easy or puzzle ? 字典树
2012-03-27 21:09 by 璋廊, 1049 阅读, 收藏,
摘要:
Description Laoda最近遇到一个难题,老师交给他很多单词(只有小写字母组成),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). Input 输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Laoda统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提问,每个提问都是一个字符串. 注意:本题只有一组测试数据,处理到文件结束. Output 对于每个提问,给出以该字符串为前缀的单词的数量. Sample Input bananabandbeeabsoluteacmbabbandabcSample O 阅读全文
poj1038
2012-03-27 17:06 by 璋廊, 213 阅读, 收藏,
摘要:
The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has 200 rooms each on the north side and south side along the corridor. Recently the Company made a plan to reform its system. The reform includes moving a lot of table 阅读全文
连通图
2012-03-27 16:52 by 璋廊, 292 阅读, 收藏,
摘要:
http://acm.zzuli.edu.cn/showproblem?problem_id=1243Time Limit:1000MS Memory Limit:65536KTotal Submit:122 Accepted:60Description 给你一个无向图,还有这个图上顶点与顶点之间的边,你能判断这个图连通吗?也就是能否从任意一个点开始可以直接或者间接访问到图上的任何一个顶点。Input首先输入一个整数t,表示有t组例子。 每组例子包括两部分; 第一部分(占一行): 一个整数n和m 表示图的顶点的个数和边的个数。 第二部分 有m行 ,每行两个整数s和t,表示顶点s和t之间有一条边 阅读全文
约瑟夫问题
2012-03-27 16:30 by 璋廊, 946 阅读, 收藏,
摘要:
Description 据传说,罗马人攻夺Jotapat后,Josephus和朋友两人与其他n个犹太人避难到一个洞穴里。使Josephus非常反感的是,他发现除了他自己和朋友外,其余的都决心殉难以免落入征服者的手中。他不敢太公然表示反对而只好同意了,但他坚持这一行动必须有条不紊地进行,并且建议大家坐成一圆圈,然后从洞口的人开始顺时针报数,数到m的人就杀掉,然后又从下一个人开始从1报数,直到最后一个人去自杀。问Josephus应该把自己和朋友放在第几个位置,才能避免被杀掉。注意:本题要求用链表实现。Input 本题有多组测试数据,第一行是测试数据组数T,下面T行的每一行有两个用一个空格隔开的数n 阅读全文
poj 1503 Integer Inquiry
2012-03-27 16:18 by 璋廊, 173 阅读, 收藏,
摘要:
DescriptionOne of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sums of those numbers.``This supercomputer is great,'' remarked Chip. ``I only wish Timothy were here to see these r 阅读全文
poj 1250 Tanning Salon
2012-03-27 12:57 by 璋廊, 194 阅读, 收藏,
摘要:
Tan Your Hide, Inc., owns several coin-operated tanning salons. Research has shown that if a customer arrives and there are no beds available, the customer will turn around and leave, thus costing the company a sale. Your task is to write a program that tells the company how many customers left with 阅读全文
求N的阶乘 N!
2012-03-27 12:48 by 璋廊, 264 阅读, 收藏,
摘要:
#include<stdio.h>#define max 100000;int main(){ int n,i,j; while(scanf("%d",&n)!=EOF) { int a[10008]={0}; a[0]=1; int k=0; for(i=1;i<=n;i++) { for(j=0;j<=k;j++)//两个for循环不能放到一起 a[j]=a[j]*i; for(j=0;j<=k;j++) { ... 阅读全文
第一次数据结构作业
2012-03-27 12:45 by 璋廊, 289 阅读, 收藏,
摘要:
*建立单链表;长度为n的量表;*/#include<stdio.h>#include<stdlib.h>typedef struct point //建立结构体{int data;struct point *next;}Linkpoint ,*LinkList;LinkList built(int n)//建立单链表{LinkList h,s,r;h=(LinkList)malloc(sizeof(Linkpoint));//头结点;r=h;int i;for(i=1;i<=n;i++){s=(LinkList)malloc(sizeof(Linkpoint)); 阅读全文
zoj 1002 Fire Net
2012-03-27 12:36 by 璋廊, 149 阅读, 收藏,
摘要:
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=2Fire NetTime Limit: 2 Seconds Memory Limit: 65536 KBSuppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a piece of wall.A blockhouse is a small 阅读全文
浙公网安备 33010602011771号