No.940 Warp ε=ε=ε=ε=ε=│;p>д<│
タグ : / 解いたユーザー数 49
作問者 :
37zigen
/ テスター :
CuriousFairy315
Problem Statement
In the year 20XX, Yuki-bako-kun (the logo at the top left) vanished from yukicoder.
A runaway artificial intelligence gave Yuki-bako-kun a mind of its own, and it fled from yukicoder.
For any non-negative integers $a,b,c,x,y,z$ with $(a,b,c)\neq \mathbf{0}$, Yuki-bako-kun can warp
from coordinates $(x,y,z)$ to coordinates $(x+a,y+b,z+c)$.
Count the number of paths from the origin $(0,0,0)$ to $(X,Y,Z)$, modulo $\bmod 10^9+7$.
Input
$X$ $Y$ $Z$
$X,Y,Z\in\mathbb{Z}$
$0\leq X\leq10^5$
$0\leq Y\leq10^5$
$0\leq Z\leq10^6$
Output
Print a newline at the end.
Sample
Sample 1
Input
1 1 0
Output
3
$(0,0,0)\to(1,1,0)$
$(0,0,0)\to(1,0,0)\to(1,1,0)$
$(0,0,0)\to(0,1,0)\to(1,1,0)$
These are the $3$ paths.
Sample 2
Input
1 1 1
Output
13By Sample 1, there are $9$ paths that pass through one of $(1,1,0),(1,0,1),(0,1,1)$.
The other paths are
$(0,0,0)\to(1,1,1)$
$(0,0,0)\to(1,0,0)\to(1,1,1)$
$(0,0,0)\to(0,1,0)\to(1,1,1)$
$(0,0,0)\to(0,0,1)\to(1,1,1)$
which make $4$ paths. Therefore there are $13$ paths in total.
Sample 3
Input
10 0 0
Output
512
Each of $(1,0,0),(2,0,0),\ldots,(9,0,0)$ is either passed through or not, giving $2^9=512$ paths.
Sample 4
Input
31 53 6000
Output
882313923
Remember to take the result mod $10^9+7$.
Sample 5
Input
0 0 0
Output
1
Yuki-bako-kun stays at the origin.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。