East Central North America Region 2015

Posted blues

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了East Central North America Region 2015相关的知识,希望对你有一定的参考价值。

E

每过一秒,当前点会把它的值传递给所有相邻点,问t时刻该图的值

 1 #include <iostream>
 2 #include <cstdio>
 3 #include <algorithm>
 4 #include <list>
 5 #include <map>
 6 #include <stack>
 7 #include <vector>
 8 #include <cstring>
 9 #include <sstream>
10 #include <string>
11 #include <cmath>
12 #include <queue>
13 using namespace std;
14 #define clc(a,b) memset(a,b,sizeof(a))
15 #define inf 0x3f3f3f3f
16 const int N=10010;
17 const int MOD = 1e9+7;
18 #define LL long long
19  
20 void fre() {
21     freopen("in.txt","r",stdin);
22 }
23 inline int r() {
24     int x=0,f=1;char ch=getchar();
25     while(ch>9||ch<0) {if(ch==-) f=-1;ch=getchar();}
26     while(ch>=0&&ch<=9) { x=x*10+ch-0;ch=getchar();}return x*f;
27 }
28  
29 vector<int>g[101]; 
30 LL countt[110];
31 LL val[110]={0};
32  
33 int main(){
34     int n,m,s,t;
35     n=r();
36     m=r();
37     s=r();
38     t=r();
39     for(int i=0;i<=n;i++)
40         g[i].clear();
41     for(int i=0;i<m;i++){
42         int x,y;
43         x=r();
44         y=r();
45         g[x].push_back(y);
46         g[y].push_back(x);
47     }
48     val[s]=1;
49     for(int i=1;i<=t;i++){
50         for(int j=0;j<n;j++)
51             countt[j]=0;
52         for(int j=0;j<n;j++){
53             LL num=val[j];
54             for(int p=0;p<(int)g[j].size();p++){
55                 int v=g[j][p];
56                 countt[v]+=num;
57             }
58         }
59         for(int j=0;j<n;j++){
60             val[j]=countt[j];
61         }
62     }
63     LL ans=0;
64     for(int i=0;i<n;i++)
65         ans+=val[i];
66     printf("%lld\n",ans);
67     return 0;
68 }

 

以上是关于East Central North America Region 2015的主要内容,如果未能解决你的问题,请参考以下文章

Gym-101673 :East Central North America Regional Contest (ECNA 2017)(寒假自训第8场)

[bfs,深度记录] East Central North America Regional Contest 2016 (ECNA 2016) D Lost in Translation

Codeforces:"North-East"

ICPC North Central NA Contest 2017

[North Central NA Contest 2018] Rational Ratio | 规律 细节模拟

ICPC North Central NA Contest 2017 部分题解