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 }

转载于:https://www.cnblogs.com/ITUPC/p/5572849.html

East Central North America Region 2015相关推荐

  1. 2019 East Central North America 部分题解

    题目链接:点这里 A.Retribution! 题意 给出nnn个人的位置.mmm个仓库1的位置以及ppp个仓库2的位置.给每个人分配一个仓库111和仓库222,问这所有的最小距离总和. 解题思路 这 ...

  2. 2018 ACM-ICPC North Central North America Regional Contest H.New Salaries

    题目:click 题意:一家公司有n个员工,第i个员工的工资范围在[LiL_iLi​,RiR_iRi​],Li−1<=LiL_{i-1}<=L_iLi−1​<=Li​,Ri−1< ...

  3. 2015 UESTC Winter Training #6【Regionals 2010 North America - Rocky Mountain】

    2015 UESTC Winter Training #6 Regionals 2010 >> North America - Rocky Mountain A - Parenthesis ...

  4. [Recap] ApacheCon North America 2019 完美谢幕

    ????️本文阅读需 5 分钟 当地时间 9 月 12 日,在拉斯维加斯举行的 ApacheCon North America 2019 完美谢幕. Java 之父 James Gosling 也来到 ...

  5. 组队练习赛(Regionals 2012, North America - East Central NA)

    A.Babs' Box Boutique 给定n个盒子,每个盒子都有长宽高(任意两个盒子长宽高不完全相同),现在选盒子的任意两面,要求x1 <= x2 && y1 <= y ...

  6. 130825组队赛-Regionals 2012, North America - East Central NA

    A.Babs' Box Boutique 一道简单的dfs搜索题,需要两两比较,然后搜到底,得到最大值就行了.比赛时队友写的,我只负责debug..赛后自己写的.. #include<iostr ...

  7. ICPC North America Qualifier Contest 2015 按通过率从 J开始

    J. Torn To Pieces 思路很简单,主要是怎么实现: #include <bits/stdc++.h> using namespace std; typedef long lo ...

  8. BNU All Your Base (Regionals 2011, North America - South Central USA) - from lanshui_Yang

    [PDF Link] Premise: Given a specification for a "base" (well, actually a mixed radix numbe ...

  9. North America - Greater NY 2013

    转载请注明出处,谢谢http://blog.csdn.net/ACM_cxlove?viewmode=contents    by---cxlove A:直接枚举岛的两个端点,两侧要低,中间部分不能低 ...

最新文章

  1. 小坑记录:get_cmap参数区分大小写
  2. Windows 10系统重装U盘启动工具制作方法实例演示,windows11镜像下载地址
  3. sql 中位数_【PL/SQL 自定义函数】 常用场景
  4. mysql常用cmd指令_Mysql cmd 常用命令
  5. 重构——解决过长参数列表(long parameter list)
  6. 史上最完整Java中将File转化为MultipartFile的方法(附阿里云腾讯云对象存储API对照)
  7. Leetcode 335. 路径交叉(Self Crossing)
  8. 稀疏内存模型sparsemem memory model | 文章
  9. python学习笔记2---内置函数
  10. Jlink 接口定义
  11. H3c服务器升级硬盘固件,H3C交换机升级固件版本
  12. 使用好压(HaoZip)软件打包EverEdit制作安装程序
  13. html如何将汉字转换成英文,中文字体转化为英文或转码
  14. 关于项目开发的量化考核。。。
  15. WebApi编程(一)-DOM
  16. 组词组合 php,PHP实现的简单组词算法示例讲解
  17. selenium进行QQ空间登录
  18. [转帖]谨以此文献给才毕业一两年的朋友 (选自同事信件)
  19. 仿思否可伸缩input搜索框
  20. 股票量化分析工具QTYX使用攻略——均线系统多头排列选股(更新2.5.7)

热门文章

  1. C语言hw,[c语言]EmailAddresses(for hw)
  2. 浅析网站站内优化重要因素都有哪些?
  3. 网站建设需要抠好每一个细节
  4. 网站seo优化相关性需要了解哪三方面内容?
  5. pythonwith作用_老生常谈Python startswith()函数与endswith函数
  6. python画饼图加牵引线_python可视化---饼图添加图例
  7. 开发日记-20190724 关键词 读书笔记《Linux 系统管理技术手册(第二版)》DAY 14
  8. Ubuntu17.10 下配置caffe 仅CPU i386可以直接apt install caffe-cpu,但是怎么运行mnist代码我懵逼了...
  9. C#网页数据采集(二)WebBrowser
  10. SQL server 行转列 列转行