| 记录编号 | 43454 | 评测结果 | AAAAAAAAAA | ||
|---|---|---|---|---|---|
| 题目名称 | 1129.[NOIP 2010冲刺五]汤姆斯的天堂梦 | 最终得分 | 100 | ||
| 用户昵称 | 是否通过 | 通过 | |||
| 代码语言 | C++ | 运行时间 | 0.563 s | ||
| 提交时间 | 2012-10-10 18:50:38 | 内存使用 | 2.87 MiB | ||
#include <iostream>
#include <cstdio>
using namespace std;
int f[110][110];
int main(void)
{
freopen("par.in","r",stdin);
freopen("par.out","w",stdout);
int i,j,n,k,from,cost,temp;
cin>>n;
for (i=1;i<=n;i++)
{
cin>>k;
f[i][1]=10000;
for (j=1;j<=k;)
{
cin>>from;
if (from==0)
{
j++;
f[i][j]=10000;
continue;
}
cin>>cost;
temp=f[i-1][from]+cost;
if (f[i][j]>temp)
f[i][j]=temp;
}
}
temp=10000;
for (j=1;j<=k;j++)
if (temp>f[n][j])
temp=f[n][j];
cout<<temp<<endl;
return(0);
}