上一页 1 ··· 7 8 9 10 11 12 13 14 15 16 下一页
  2013年8月2日
摘要: Language:Radar InstallationTime Limit:1000MSMemory Limit:10000KTotal Submissions:42461Accepted:9409DescriptionAssume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar installation, locati 阅读全文
posted @ 2013-08-02 14:46 straw_berry 阅读(167) 评论(0) 推荐(0) 编辑
  2013年7月31日
摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 const int INF = 0x3f3f3f3f; 9 const int MAX = 10000;10 11 struct edge12 {13 int to,w;14 };15 int n,m;16 int inque[MAX+10];//标记节点是否在队列里17 int dis[MAX+10];//保存最短路径18 int vexcnt[MAX+10];//保存节点进队次数19 vectormap[MAX+10... 阅读全文
posted @ 2013-07-31 17:31 straw_berry 阅读(196) 评论(0) 推荐(0) 编辑
  2013年7月30日
摘要: DescriptionGiven m sequences, each contains n non-negative integer. Now we may select one number from each sequence to form a sequence with m integers. It's clear that we may get n ^ m this kind of sequences. Then we can calculate the sum of numbers in each sequence, and get n ^ m values. What w 阅读全文
posted @ 2013-07-30 15:02 straw_berry 阅读(204) 评论(0) 推荐(0) 编辑
摘要: Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n 3 #include 4 using namespace std; 5 6 int n,k,ans; 7 char map[10][10]; 8 int vis[10];//标记某列是否被访问 9 10 void dfs(i.. 阅读全文
posted @ 2013-07-30 08:26 straw_berry 阅读(318) 评论(0) 推荐(0) 编辑
  2013年7月29日
摘要: DescriptionWhile exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time that is BEFORE you entered the wormhole! Each of FJ's farms comprisesN(1 ≤N≤ 500) fields co 阅读全文
posted @ 2013-07-29 13:10 straw_berry 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 题目描述二叉排序树的定义是:或者是一棵空树,或者是具有下列性质的二叉树: 若它的左子树不空,则左子树上所有结点的值均小于它的根结点的值; 若它的右子树不空,则右子树上所有结点的值均大于它的根结点的值; 它的左、右子树也分别为二叉排序树。 今天我们要判断两序列是否为同一二叉排序树输入开始一个数n,(1 2 #include 3 #include 4 struct node 5 { 6 char data; 7 struct node *left,*right; 8 }; 9 int ans;10 //递归建立二叉排序树11 void build(struct node **p,c... 阅读全文
posted @ 2013-07-29 09:17 straw_berry 阅读(178) 评论(0) 推荐(0) 编辑
  2013年7月28日
摘要: 现在银行已经很普遍,每个人总会去银行办理业务,一个好的银行是要考虑 平均逗留时间的,即: 在一定时间段内所有办理业务的人员逗留的时间的和/ 总的人数。逗留时间定义为 人员离开的时间减去人员来的时间。银行只有考虑了这一点,我们在办理业务的时候,才不会等太多的时间。为了简化问题,我们认为银行只有一号窗口和二号窗口可以办理业务 ,并且在时间范围是12=0&&time0&&y 2 #include 3 #include 4 5 struct node 6 { 7 int x,y,t; 8 }; 9 10 int cmp(const void *a, const void 阅读全文
posted @ 2013-07-28 17:27 straw_berry 阅读(510) 评论(0) 推荐(0) 编辑
摘要: 题目描述小明在学习了数据结构之后,突然想起了以前没有解决的算术表达式转化成后缀式的问题,今天他想解决一下。 因为有了数据结构的基础小明很快就解出了这个问题,但是他突然想到怎么求出算术表达式的前缀式和中缀式呢?小明很困惑。聪明的你帮他解决吧。输入输入一算术表达式,以\'#\'字符作为结束标志。(数据保证无空格,只有一组输入)输出输出该表达式转换所得到的前缀式 中缀式 后缀式。分三行输出,顺序是前缀式 中缀式 后缀式。示例输入a*b+(c-d/e)*f#示例输出+*ab*-c/defa*b+c-d/e*fab*cde/-f*+代码操作归结为:将中缀式转化为后缀式;将后缀式转化为表达 阅读全文
posted @ 2013-07-28 15:45 straw_berry 阅读(983) 评论(0) 推荐(0) 编辑
  2013年7月15日
摘要: 题目描述Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 100,000) on the same number line. Farmer John has two modes of transportation: walking and teleportin 阅读全文
posted @ 2013-07-15 18:34 straw_berry 阅读(199) 评论(0) 推荐(0) 编辑
  2013年6月29日
摘要: 题目描述给定一个无向连通图,顶点编号从0到n-1,用广度优先搜索(BFS)遍历,输出从某个顶点出发的遍历序列。(同一个结点的同层邻接点,节点编号小的优先遍历)输入输入第一行为整数n(0 2 #include 3 #include 4 #include 5 using namespace std; 6 priority_queue, greater >head[100]; 7 queueq; 8 bool vis[110]; 9 int flag;10 void bfs()11 {12 while(!q.empty())13 {14 int cur = q.fro... 阅读全文
posted @ 2013-06-29 19:14 straw_berry 阅读(513) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 16 下一页