Problem Description 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹.怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里来求救了,请帮助计算一下最少需要多少套拦截系统. Input 输入若干组数据.每组数据包括:导弹总个数(正…
//代码: //方法1:Dijkstra's Algorithm #include<stdio.h> #include<math.h> #include<string.h> #define INF 0xfffffff #define N 110 #define min(a, b)(a < b ? a : b) int maps[N][N]; int d[N], visit[N]; int n, m; void Init() { int i, j; memset(v…
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<queue> #include<math.h> #define N 10010 using namespace std; int vis[N]; ], s2[], s3[]; struct node { int step; ]; }; int prime(int y) { int i, k = (int)sqrt(y)…
#include<stdio.h> #include<string.h> #include<math.h> #include<stdlib.h> #define max(a, b)(a > b ? a : b) #define N 30 char maps[N][N]; int m, n, ans; ][] = {{, }, {, -}, {, }, {-, }}; void DFS(int x, int y) { int a, b, i; maps[…
#include<stdio.h> #include<stack> #include<string.h> #define N 20 using namespace std; int main() { stack<char>S; int n, i, j, k, a[N]; char s1[N], s2[N]; while(scanf("%d", &n) != EOF) { while(!S.empty())//清空栈 S.pop()…
zxa and leaf Problem Description zxa have an unrooted tree with n nodes, including (n−1) undirected edges, whose nodes are numbered from 1 to n. The degree of each node is defined as the number of the edges connected to it, and each node whose degree…
传送门 GTY's gay friends Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 264 Accepted Submission(s): 57 Problem Description GTY has n gay friends. To manage them conveniently, every morning he o…
传送门 DZY Loves Topological Sorting Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 221 Accepted Submission(s): 52 Problem Description A topological sort or topological ordering of a directed…
http://acm.hdu.edu.cn/showproblem.php?pid=5063 题目大意: 题目意思还是比较简单.所以就不多少了.注意这句话,对解题有帮助. Type4: Q i query current value of a[i], this operator will have at most 50. 解题思路: 因为给定n和m都是100000,我们每一步都做具体的操作,时间将是O(n*m),肯定超时.最开始的时候 我怎么想都不知道怎么解决.以为是线段树.比赛完了以后,看了解…