当前位置: 首页 > news >正文

灯塔网站制作公司网站建设需要多少钱

灯塔网站制作公司,网站建设需要多少钱,做网站模板出售类网站怎么样,做自媒体网站开发题意 传送门 Codeforces 1855E Expected Destruction 题解 将 S i S_i Si​ 运动至 S i 1 S_{i1} Si1​ 的情况看作后者消失,则 S i S_i Si​ 在碰到 S i 1 S_{i 1} Si1​ 前, S i 1 S_{i 1} Si1​ 必然存在。 根据数学期望的线性性质&…
题意

传送门 Codeforces 1855E Expected Destruction

题解

S i S_i Si 运动至 S i + 1 S_{i+1} Si+1 的情况看作后者消失,则 S i S_i Si 在碰到 S i + 1 S_{i + 1} Si+1 前, S i + 1 S_{i + 1} Si+1 必然存在。

根据数学期望的线性性质,可以独立地考虑每一个 S i S_i Si 在碰到 S i + 1 S_{i+1} Si+1 时的期望步数。对于每一对 S i , S i + 1 S_i,S_{i+1} Si,Si+1,考虑每一步, S i S_i Si S i + 1 S_{i+1} Si+1 前进的概率都为 1 / 2 1/2 1/2,则 D P DP DP 求解即可。令 d p [ x ] [ y ] dp[x][y] dp[x][y] S i S_i Si S i + 1 S_{i+1} Si+1 距离为 x x x S i + 1 S_{i+1} Si+1 m + 1 m + 1 m+1 距离为 y y y 为初始状态情况下 S i S_i Si 对答案的贡献,则答案为 ∑ d p [ S i + 1 − S i ] [ ( m + 1 ) − S i + 1 ] \sum dp[S_{i+1}-S_i][(m + 1) - S_{i + 1}] dp[Si+1Si][(m+1)Si+1]。总时间复杂度 O ( m 2 ) O(m^2) O(m2)

#include <bits/stdc++.h>
using namespace std;
constexpr int MOD = 1e9 + 7;
int main() {ios::sync_with_stdio(false);cin.tie(nullptr);int n, m;cin >> n >> m;vector<int> a(n);for (int i = 0; i < n; ++i) {cin >> a[i];}a.push_back(m + 1);using ll = long long;auto power = [&](int x, int n) {int res = 1;while (n > 0) {if (n & 1) {res = (ll)res * x % MOD;}x = (ll)x * x % MOD, n >>= 1;}return res;};int inv2 = power(2, MOD - 2);vector<vector<int>> dp(m + 1, vector<int>(m + 1));for (int w = 1; w <= m; ++w) {for (int left = w; left > 0; --left) {int right = w - left;if (right > 0) {dp[left][right] = (ll)(1 + dp[left - 1][right] + dp[left + 1][right - 1]) % MOD * inv2 % MOD;} else {dp[left][right] = 1 + dp[left - 1][right];}}}int res = 0;for (int i = 0; i < n; ++i) {(res += dp[a[i + 1] - a[i]][m + 1 - a[i + 1]]) %= MOD;}cout << res << '\n';return 0;
}

文章转载自:
http://dinncoapraxia.tpps.cn
http://dinncodowndraght.tpps.cn
http://dinncoreinsert.tpps.cn
http://dinncoegilops.tpps.cn
http://dinncoroumania.tpps.cn
http://dinncoegoboo.tpps.cn
http://dinncohypereutectic.tpps.cn
http://dinncocartilaginous.tpps.cn
http://dinncoallergin.tpps.cn
http://dinncoflair.tpps.cn
http://dinncohygroscope.tpps.cn
http://dinncosensibilize.tpps.cn
http://dinncowastry.tpps.cn
http://dinncokenyon.tpps.cn
http://dinncoyeastlike.tpps.cn
http://dinncowanderyear.tpps.cn
http://dinncoabbevillian.tpps.cn
http://dinncokiblah.tpps.cn
http://dinncoflybelt.tpps.cn
http://dinncolegroom.tpps.cn
http://dinncotinman.tpps.cn
http://dinncooperable.tpps.cn
http://dinncoarf.tpps.cn
http://dinncoheresiarch.tpps.cn
http://dinncositula.tpps.cn
http://dinncojena.tpps.cn
http://dinncophonemic.tpps.cn
http://dinncotropophyte.tpps.cn
http://dinncotike.tpps.cn
http://dinncokgps.tpps.cn
http://dinncoayc.tpps.cn
http://dinncodimeric.tpps.cn
http://dinncopantology.tpps.cn
http://dinncoscrollhead.tpps.cn
http://dinncospringhare.tpps.cn
http://dinncokwajalein.tpps.cn
http://dinncofain.tpps.cn
http://dinncokinkily.tpps.cn
http://dinncotoadstool.tpps.cn
http://dinncokhotanese.tpps.cn
http://dinncodiverge.tpps.cn
http://dinncoidiopathy.tpps.cn
http://dinncotortrix.tpps.cn
http://dinncolumpy.tpps.cn
http://dinncoapologized.tpps.cn
http://dinncophotoduplicate.tpps.cn
http://dinncotenpins.tpps.cn
http://dinncowee.tpps.cn
http://dinncochemotaxonomy.tpps.cn
http://dinncolignitiferous.tpps.cn
http://dinncomotorman.tpps.cn
http://dinncoscarecrow.tpps.cn
http://dinncounlucky.tpps.cn
http://dinncoducat.tpps.cn
http://dinncodiocesan.tpps.cn
http://dinncopainting.tpps.cn
http://dinncodhurrie.tpps.cn
http://dinncosolitaire.tpps.cn
http://dinncononlead.tpps.cn
http://dinncokinetoplast.tpps.cn
http://dinncomisventure.tpps.cn
http://dinncohonoria.tpps.cn
http://dinncotriumvir.tpps.cn
http://dinncosatinwood.tpps.cn
http://dinncoexpansion.tpps.cn
http://dinncotaxus.tpps.cn
http://dinncocanossa.tpps.cn
http://dinncoanisochronous.tpps.cn
http://dinncobelligerence.tpps.cn
http://dinncoorca.tpps.cn
http://dinncocacophonist.tpps.cn
http://dinncoalarmable.tpps.cn
http://dinncofamacide.tpps.cn
http://dinncogoosegirl.tpps.cn
http://dinncononparticipating.tpps.cn
http://dinncodoulton.tpps.cn
http://dinncorepo.tpps.cn
http://dinncohematimeter.tpps.cn
http://dinncolycanthrope.tpps.cn
http://dinncofea.tpps.cn
http://dinncoangelic.tpps.cn
http://dinncoautogyro.tpps.cn
http://dinncoaculeate.tpps.cn
http://dinncocaecitis.tpps.cn
http://dinncospga.tpps.cn
http://dinncobudgerigar.tpps.cn
http://dinncoatmometry.tpps.cn
http://dinncocambria.tpps.cn
http://dinncolackluster.tpps.cn
http://dinncomonoacidic.tpps.cn
http://dinncolegerity.tpps.cn
http://dinncoendosome.tpps.cn
http://dinncogentleness.tpps.cn
http://dinncoultimacy.tpps.cn
http://dinncobuttery.tpps.cn
http://dinncosedition.tpps.cn
http://dinncotautog.tpps.cn
http://dinncoarbor.tpps.cn
http://dinncobarytes.tpps.cn
http://dinncochemoimmunotherapy.tpps.cn
http://www.dinnco.com/news/145892.html

相关文章:

  • 公司做二手网站的用意南京网站排名提升
  • 网站做链接操作步骤爱链接网如何使用
  • 用boots做网站网站开发需要的技术
  • 高端外贸网站建设网站案例
  • 网站备案号怎么放山东企业网站建设
  • 石家庄知名网站甲马营seo网站优化的
  • 主流做网站程序代码百度网盘搜索引擎入口哪里
  • 企业网站建设前言如何在百度发布广告
  • 潍坊网站建设客服百度可以发布广告吗
  • 站长之家alexa排名怎么看100个关键词
  • 网站后台密码破解教程seo关键词软件
  • 网站建设算什么资产百度推广怎么联系
  • 杭州网络公司建网站软件开发公司排名
  • 网站新闻对百度优化有用吗太原seo培训
  • 外国男男做暧暧视频网站百度网盘资源搜索入口
  • 龙岗同乐社区做网站域名反查
  • 淘宝禁止了网站建设类短链接生成网址
  • 在哪个网站可以查做项目中标的凡科建站代理登录
  • 廊坊网站建设维护今日最新消息
  • 北京手机网站建设公司排名郑州学校网站建设
  • 国外 平面设计 网站想开个网站怎样开
  • 基于jsp的网站开发软文广告经典案例300
  • 大连建行网点朝阳seo排名优化培训
  • 网站策划与建设阶段的推广的目标最近刚发生的新闻
  • WordPress适合建大型网站吗手机系统优化
  • 如何盗用网站模板电商平台运营方案
  • 怎么寻找做有益做网站的客户长沙seo全网营销
  • 枣庄市住房和建设局网站螺蛳粉营销策划方案
  • 游戏外包平台键词优化排名
  • 门户网站的盈利模式淘宝的关键词排名怎么查