###### TOJ1004 防御导弹问题

/*

http://acm.tongji.edu.cn/people/ps/showproblem.php?problem_id=1004

Time Limit:1s Memory Limit:1000k
Total Submit:4585 Accepted:1439

Time Limit:1s Memory Limit:1000k
Total Submit:4585 Accepted:1439

Time Limit:1s Memory Limit:1000k
Total Submit:4585 Accepted:1439

--------------------------------------------------------------------------------

Problem

Input

Output

Sample Input
300 250 275 252 200 138 245

Sample Output
5 2

*/

#include <stdio.h>

int main()
{
int decv[20], decx[20];
int i, j, M, N, count, left, max, idx;

count = 0;
while (scanf("%d", &height[count]) != EOF)
count++;

for (i=0; i<count; i++)

left = count;
M = N = 0;
while (left > 0)
{
max = 0;
for (i=count-1; i>=0; i--)
{
decv[i] = 1;
decx[i] = -1;
for (j=i+1; j<count; j++)
{
if (height[i] >= height[j] && decv[i] < 1+decv[j])
{
decv[i] = 1+decv[j];
decx[i] = j;
}
}
if (max < decv[i])
{
max = decv[i];
idx = i;
}
}

if (M < max)
M = max;

left -= max;
N++;
i = idx;
while (i != -1)
{
i = decx[i];
}
}
printf("%d %d/n", M, N);

return 0;
}

#### 导弹防御问题 动态规划 java

2013-10-04 01:29:37

#### 1048: 导弹防御系统

2016-08-12 12:23:43

#### 动态规划——防卫导弹

2016-11-13 20:04:28

#### 题目1085: 拦截导弹

2013-03-25 10:01:27

#### C++动态规划算法之拦截导弹

2017-06-11 22:46:25

#### 机试算法讲解：第50题 动态规划之拦截导弹

2015-08-01 14:55:33

#### Acm 导弹拦截

2016-08-20 14:29:16

#### nyist oj 79 拦截导弹 (动态规划基础题）

2014-08-15 14:06:44

#### 蓝桥杯 ALGO-13 算法训练 拦截导弹 Java版

2017-02-24 01:36:21

#### NYOJ 题目79 拦截导弹（dp）

2016-03-02 20:19:49

TOJ1004 防御导弹问题