记录编号 |
441587 |
评测结果 |
AAAAAAAAAA |
题目名称 |
森林大礼包 |
最终得分 |
100 |
用户昵称 |
xzz_233 |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.234 s |
提交时间 |
2017-08-25 11:42:03 |
内存使用 |
4.87 MiB |
显示代码纯文本
- // It is made by XZZ
- #include<cstdio>
- #include<algorithm>
- #define Fname "three_squirrels"
- using namespace std;
- #define rep(a,b,c) for(rg int a=b;a<=c;a++)
- #define drep(a,b,c) for(rg int a=b;a>=c;a--)
- #define erep(a,b) for(rg int a=fir[b];a;a=nxt[a])
- #define il inline
- #define rg register
- #define vd void
- typedef long long ll;
- il int gi(){
- rg int x=0,f=1;rg char ch=getchar();
- while(ch<'0'||ch>'9')f=ch=='-'?-1:f,ch=getchar();
- while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
- return x*f;
- }
- int a[100001][10],k[100001];
- int g[100001];
- il int f(int s){
- if(g[s])return g[s];
- rep(i,0,k[s]-1)g[s]=(g[s]+f(a[s][i]))%1000000007;
- return g[s];
- }
- int main(){
- freopen(Fname".in","r",stdin);
- freopen(Fname".out","w",stdout);
- int n=gi();
- rep(i,1,n){
- k[i]=gi();
- rep(j,0,k[i]-1)a[i][j]=gi();
- }
- g[0]=1;
- printf("%d\n",f(n));
- return 0;
- }
-