首页 > 其他分享 >ABC240G Teleporting Takahashi

ABC240G Teleporting Takahashi

时间:2023-02-20 12:33:47浏览次数:62  
标签:ABC240G Teleporting limits 2S sum 2a frac binom Takahashi

ABC240G Teleporting Takahashi

洛谷:ABC240G Teleporting Takahashi

Atcoder:ABC240G Teleporting Takahashi

Problem

在一个空间直角坐标系中移动,每步可以沿着坐标轴正/负方向移动一个单位的长度。

给定 \(N,X,Y,Z\) ,求:

恰好 \(N\) 步,从点 \((0,0,0)\) 走到点 \((X,Y,Z)\) 的方案数。

答案对 \(998244353\) 取模。\(N,X,Y,Z \le 10^7\)。s

Solution

先把答案为 \(0\) 判掉。

记 \(w = \frac{n - x - y - z}{2}\)。

答案为:

\[\sum\limits_{a_1 + a_2 + a_3 = w}\binom{x + 2a_1}{a_1}\binom{y + 2a_2}{a_2}\binom{z + 2a_3}{a_3}\binom{n}{x + 2a_1}\binom{n - x - 2a_1}{y + 2a_2} \]

然后化简。拆开消项以组成新的二项式系数

\[\begin{aligned} ans &= \sum\limits_{a_1 + a_2 + a_3 = w}\binom{x + 2a_1}{a_1}\binom{y + 2a_2}{a_2}\binom{z + 2a_3}{a_3}\binom{n}{x + 2a_1}\binom{n - x - 2a_1}{y + 2a_2} \\ &= \sum\limits_{a_1 + a_2 = 0}^{w}\binom{x + 2a_1}{a_1}\binom{y + 2a_2}{a_2}\binom{z + 2(w - a_1 - a_2)}{w - a_1 - a_2}\binom{n}{x + 2a_1}\binom{n - x - 2a_1}{y + 2a_2} \\ &= \sum\limits_{S = 0}^{w}\sum\limits_{a_1 = 0}^{S}\binom{x + 2a_1}{a_1}\binom{y + 2S - 2a_1}{S - a_1}\binom{z + 2w - 2S}{w - S}\binom{n}{x + 2a_1}\binom{n - x - 2a_1}{y + 2S - 2a_1} \\ &= \sum\limits_{S = 0}^{w}\binom{z + 2w - 2S}{w - S}\sum\limits_{a_1 = 0}^{S}\binom{x + 2a_1}{a_1}\binom{y + 2S - 2a_1}{S - a_1}\binom{n}{x + 2a_1}\binom{n - x - 2a_1}{y + 2S - 2a_1} \\ \end{aligned} \]

记 \(W = \sum\limits_{a_1 = 0}^{S}\binom{x + 2a_1}{a_1}\binom{y + 2S - 2a_1}{S - a_1}\binom{n}{x + 2a_1}\binom{n - x - 2a_1}{y + 2S - 2a_1}\)。

\[\begin{aligned} W &= \sum\limits_{a_1 = 0}^{S}\binom{x + 2a_1}{a_1}\binom{y + 2S - 2a_1}{S - a_1}\binom{n}{x + 2a_1}\binom{n - x - 2a_1}{y + 2S - 2a_1} \\ &= \sum\limits_{a_1 = 0}^{S} \frac{(x + 2a_1)!}{a_1!(x + a_1)!}\frac{(y + 2S - 2a_1)!}{(S - a_1)!(y + S - a_1)!}\frac{n!}{(x + 2a_1)!(n - x - 2a_1)!}\frac{(n - x - 2a_1)!}{(y + 2S - 2a_1)!(n - x - y - 2S)!} \\ &= \sum\limits_{a_1 = 0}^{S}\frac{n!}{a_1!(x + a_1)!(S - a_1)!(y + S - a_1)!(n - x - y - 2S)!} \\ &= n! \times \frac{1}{S!} \times \frac{1}{(x + y + S)!} \times \frac{1}{(n - x - y - 2S)!} \sum\limits_{a_1 = 0}^{S} \frac{S!}{a_1!(S - a_1)!}\frac{(x + y + S)!}{(x + a_1)!(y + S - a_1)!} \\ &= \frac{n!}{S!(x + y + S)!(n - x - y - 2S)!}\sum\limits_{a_1 = 0}^{S}\binom{S}{a_1}\binom{x + y + S}{y + S - a_1} \\ &= \frac{n!}{S!(x + y + S)!(n - x - y - 2S)!} \binom{x + y + 2S}{y + S} \end{aligned} \]

于是可以枚举 \(S\)。

code ABC240G Teleporting Takahashi

标签:ABC240G,Teleporting,limits,2S,sum,2a,frac,binom,Takahashi
From: https://www.cnblogs.com/Schucking-Sattin/p/17136911.html

相关文章

  • [ABC250Ex] Trespassing Takahashi 题解
    [ABC250Ex]TrespassingTakahashiSolution目录[ABC250Ex]TrespassingTakahashiSolution更好的阅读体验戳此进入题面SolutionCodeUPD更好的阅读体验戳此进入题面给......
  • [ABC256E] Takahashi's Anguish 题解
    [ABC256E]Takahashi'sAnguishSolution目录[ABC256E]Takahashi'sAnguishSolution更好的阅读体验戳此进入题面SolutionCodeUPD更好的阅读体验戳此进入题面存在$n......
  • Destroyer Takahashi
    DestroyerTakahashi题解:区间选点问题这里面他又给出了D,D其实可以代表他从右端点还可以往外延申D-1的长度,实际上每次的\(now=a[i].r+D-1\)#include<bits/stdc++.h>......
  • [ABC233G] Strongest Takahashi
    ProblemStatementThereisa$N\timesN$grid,withblocksonsomesquares.Thegridisdescribedby$N$strings$S_1,S_2,\dots,S_N$,asfollows.Ifthe$j$-t......
  • D - Takahashi's Solitaire -- ATCODER
    D-Takahashi'sSolitairehttps://atcoder.jp/contests/abc277/tasks/abc277_d 思路先计算所有的输入的和total,将输入列表首先进行排列找到所有连续段和中最大的......
  • C - Ladder Takahashi -- ATCODER
    C-LadderTakahashihttps://atcoder.jp/contests/abc277/tasks/abc277_c 思路把梯子可达楼层看成图的节点把梯子看成节点之间的连线所以整个问题变成图的遍历问题......
  • AtCoder Beginner Contest 277 D Takahashi's Solitaire
    Takahashi'sSolitaire双指针&&尺取先排个序,然后把数组扩展到\(2\timesn\),为了处理循环的情况然后双指针跑一下,限定\(r\)扩展的条件为:当前数字等于前一个或者......