上一页 1 2 3 4 5 6 ··· 9 下一页
摘要: Ocean CurrentsTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1148 Accepted Submission(s): 382Problem DescriptionFor a boat on a large body of water, strong currents can be dangerous, but with careful planning, they can be harnessed to help the... 阅读全文
posted @ 2013-03-20 19:27 尔滨之夏 阅读(427) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。中央情报局要研究敌人究竟演习什么战术,所以Tidy要随时向Derek汇报某一段连续的工兵营地一共有多少人,例如Derek问:“Tidy,马上汇报第3个营地到第10个营地共有多少人!”Tidy就要马上开始计算 阅读全文
posted @ 2013-03-19 21:35 尔滨之夏 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 题意:要求找出不能到达0的输出TRAPPED,从0开始不能到达的输出UNREACHABLE,都满足的输出NO PROBLEMS,样例:60 1 11 1 22 3 1 3 03 04 2 5 05 1 421 1 00 1 1TRAPPED 3UNREACHABLE 4UNREACHABLE 5NO PROBLEMS#include<cstdio>#include<cstring>typedef struct node{ int f; int t; int next;}Qstr;Qstr q[1010];int h[1010];int v[1010];int tot;v 阅读全文
posted @ 2013-03-18 22:09 尔滨之夏 阅读(194) 评论(0) 推荐(0) 编辑
摘要: #include<cstdio>#include<cmath>#include<algorithm>#include<iostream>typedef struct Node{ double l; double r; bool operator < (const Node & a) const { return l < a.l; }}Qstr;Qstr q[1500];using namespace std;int main(void){ int n; int d; int res; int kase = 0; whil... 阅读全文
posted @ 2013-03-13 20:00 尔滨之夏 阅读(248) 评论(0) 推荐(0) 编辑
摘要: Problem Description某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。Input本题目包含多组数据,请处理到文件结束。每组数据第一行包含两个正整数N和M(0<N<200,0<M<1000),分别代表现有城镇的数目和已修建的道路的数目。城镇分别以0~N-1编号。接下来是M行道路信息。每一行有三个整数A,B,X(0<=A,B<N,A! 阅读全文
posted @ 2013-03-12 19:25 尔滨之夏 阅读(342) 评论(0) 推荐(0) 编辑
摘要: Problem Description为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格不等,并且只能整袋购买。请问:你用有限的资金最多能采购多少公斤粮食呢?Input输入数据首先包含一个正整数C,表示有C组测试用例,每组测试用例的第一行是两个整数n和m(1<=n<=100, 1<=m<=100),分别表示经费的金额和大米的种类,然后是m行数据,每行包含3个数p,h和c(1<=p<=20,1<=h<=200,1<=c<=20),分别表示每袋的价 阅读全文
posted @ 2013-03-06 19:34 尔滨之夏 阅读(268) 评论(0) 推荐(0) 编辑
摘要: DescriptionMarsha and Bill own a collection of marbles. They want to split the collection among themselves so that both receive an equal share of the marbles. This would be easy if all the marbles had the same value, because then they could just split the collection in half. But unfortunately, s... 阅读全文
posted @ 2013-03-05 18:48 尔滨之夏 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 分析:广搜,每个四位数作为一个状态,从每个状态扩展出其他的几种状态并累加步数之后加入队列。 1 #include <stdio.h> 2 #include <string.h> 3 #include <algorithm> 4 using namespace std; 5 6 int vis[10][10][10][10]; //标记数组 7 8 struct node 9 { 10 int step; 11 int num[4]; 12 }q[8000], tt, in, st, end; 13 int front,rear; 14 15 bool ... 阅读全文
posted @ 2013-03-04 19:36 尔滨之夏 阅读(344) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 #include<string.h> 3 4 const int max = 110; 5 6 int dp[max][max]; 7 int num[max]; 8 9 int Mult(int a, int b)10 {11 if (dp[a][b] > 0)12 {13 return dp[a][b];14 }15 if (a == b)16 {17 return 0;18 }19 int min = Mult(a+1, b) + num[a-1] ... 阅读全文
posted @ 2013-02-28 14:19 尔滨之夏 阅读(338) 评论(0) 推荐(0) 编辑
摘要: 当数组长度p,q范围高达10000所以O(pq)的算法会超时。注意到序列中所有元素各不相同,因此可以把A串重新编号为1~p,例如:A={1754832},B={14356287} 把A重新编号后:A={1234567},B={14630752}其中0表示在A中没有出现过,因为没有出现过所以就不用考虑了,肯定不在最长公共子序列中。对于新的A,B序列只需求B的最长递增子序列即可。因为n的范围较大,所以需要用到O(nlogn)的方法求最长递增子序列(二分)。 1 #include<stdio.h> 2 #include<string.h> 3 4 const int MAX 阅读全文
posted @ 2012-12-10 22:28 尔滨之夏 阅读(273) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 9 下一页