比赛 |
NOIP模拟赛by mzx Day2 |
评测结果 |
AAAAAAAWWW |
题目名称 |
森林大礼包 |
最终得分 |
70 |
用户昵称 |
Earl_WR |
运行时间 |
0.573 s |
代码语言 |
C++ |
内存使用 |
1.66 MiB |
提交时间 |
2016-10-20 20:01:44 |
显示代码纯文本
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
long long bag[100010],n,num[100010],t;
int read()
{
int x=0,f=1;char ch=getchar();
while (ch<'0' || ch>'9'){if (ch=='-')f=-1;ch=getchar();}
while (ch>='0' && ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
int main()
{
freopen ("three_squirrels.in","r",stdin);
freopen ("three_squirrels.out","w",stdout);
memset(bag,0,sizeof(bag));
n=read();
bag[0]=1;
for (int i=1;i<=n;i++)
{
num[i]=read();
for (int j=1;j<=num[i];j++)
{
t=read();
bag[i]=(bag[i]+bag[t])%1000000007;
}
}
cout<<bag[n]<<endl;
return 0;
}