A15464 | Kill Demodogs
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Demodogs from the Upside-down have attacked Hawkins again. El wants to reach Mike and also kill as many Demodogs in the way as possible.
Hawkins can be represented as an $n \times n$ grid. The number of Demodogs in a cell at the $i$ -th row and the $j$ -th column is $i \cdot j$ . El is at position $(1, 1)$ of the grid, and she has to reach $(n, n)$ where she can find Mike.
The only directions she can move are the right (from $(i, j)$ to $(i, j + 1)$ ) and the down (from $(i, j)$ to $(i + 1, j)$ ). She can't go out of the grid, as there are doors to the Upside-down at the boundaries.
Calculate the maximum possible number of Demodogs $\mathrm{ans}$ she can kill on the way, considering that she kills all Demodogs in cells she visits (including starting and finishing cells).
Print $2022 \cdot \mathrm{ans}$ modulo $10^9 + 7$ . Modulo $10^9 + 7$ because the result can be too large and multiplied by $2022$ because we are never gonna see it again!
(Note, you firstly multiply by $2022$ and only after that take the remainder.)
Hawkins can be represented as an $n \times n$ grid. The number of Demodogs in a cell at the $i$ -th row and the $j$ -th column is $i \cdot j$ . El is at position $(1, 1)$ of the grid, and she has to reach $(n, n)$ where she can find Mike.
The only directions she can move are the right (from $(i, j)$ to $(i, j + 1)$ ) and the down (from $(i, j)$ to $(i + 1, j)$ ). She can't go out of the grid, as there are doors to the Upside-down at the boundaries.
Calculate the maximum possible number of Demodogs $\mathrm{ans}$ she can kill on the way, considering that she kills all Demodogs in cells she visits (including starting and finishing cells).
Print $2022 \cdot \mathrm{ans}$ modulo $10^9 + 7$ . Modulo $10^9 + 7$ because the result can be too large and multiplied by $2022$ because we are never gonna see it again!
(Note, you firstly multiply by $2022$ and only after that take the remainder.)
输入格式
Each test contains multiple test cases. The first line contains the number of test cases $t$ ( $1 \leq t \leq 10^4$ ). Description of the test cases follows.
The first line of each test case contains one integer $n$ ( $2 \leq n \leq 10^9$ ) — the size of the grid.
The first line of each test case contains one integer $n$ ( $2 \leq n \leq 10^9$ ) — the size of the grid.
输出格式
For each test case, print a single integer — the maximum number of Demodogs that can be killed multiplied by $2022$ , modulo $10^9 + 7$ .
输入输出样例
输入 #1
4 2 3 50 1000000000
输出 #1
14154 44484 171010650 999589541
In the first test case, for any path chosen by her the number of Demodogs to be killed would be $7$ , so the answer would be $2022 \cdot 7 = 14154$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted