poj1949

poj水题。。

直接上代码

 1 /*
 2   State:Accepted
 3   Time:2013-03-12 00:42:31
 4 */
 5 #include <iostream>
 6 #include <cstring>
 7 #include <string>
 8 #include <cstdlib>
 9 #include <cstdio>
10 #include <algorithm>
11 #include <cmath>
12 #include <queue>
13 using namespace std;
14 struct oo{ int l, p , s; };
15 int n , f[200100];
16 
17 void dp()
18 {
19      int time , m , l , tmp ,ans(0);
20      scanf("%d",&n);
21      for (int i = 1;  i <=n; ++i)
22       {
23           scanf("%d",&time);
24           scanf("%d",&m);
25           tmp = 0;
26           for (int j = 1; j <= m; ++j)
27            {
28               scanf("%d",&l);
29               tmp = max(f[l], tmp);
30            }
31           f[i] = tmp + time;
32           ans = max(ans , f[i]);
33       }
34       printf("%d\n",ans);
35 
36         
37 }
38 
39 
40 int main(){
41      freopen("poj1949.in","r",stdin);
42      freopen("poj1949.out","w",stdout);
43      dp();
44 }
原文地址:https://www.cnblogs.com/yzcstc/p/2977937.html