A14278 | Contest Start
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
There are $n$ people participating in some contest, they start participating in $x$ minutes intervals. That means the first participant starts at time $0$ , the second participant starts at time $x$ , the third — at time $2 \cdot x$ , and so on.
Duration of contest is $t$ minutes for each participant, so the first participant finishes the contest at time $t$ , the second — at time $t + x$ , and so on. When a participant finishes the contest, their dissatisfaction equals to the number of participants that started the contest (or starting it now), but haven't yet finished it.
Determine the sum of dissatisfaction of all participants.
Duration of contest is $t$ minutes for each participant, so the first participant finishes the contest at time $t$ , the second — at time $t + x$ , and so on. When a participant finishes the contest, their dissatisfaction equals to the number of participants that started the contest (or starting it now), but haven't yet finished it.
Determine the sum of dissatisfaction of all participants.
输入格式
The first line contains a single integer $k$ ( $1 \le k \le 1000$ ) — the number of test cases.
Each of the next $k$ lines contains three integers $n$ , $x$ , $t$ ( $1 \le n, x, t \le 2 \cdot 10^9$ ) — the number of participants, the start interval and the contest duration.
Each of the next $k$ lines contains three integers $n$ , $x$ , $t$ ( $1 \le n, x, t \le 2 \cdot 10^9$ ) — the number of participants, the start interval and the contest duration.
输出格式
Print $k$ lines, in the $i$ -th line print the total dissatisfaction of participants in the $i$ -th test case.
输入输出样例
输入 #1
4 4 2 5 3 1 2 3 3 10 2000000000 1 2000000000
输出 #1
5 3 3 1999999999000000000
In the first example the first participant starts at $0$ and finishes at time $5$ . By that time the second and the third participants start, so the dissatisfaction of the first participant is $2$ .
The second participant starts at time $2$ and finishes at time $7$ . By that time the third the fourth participants start, so the dissatisfaction of the second participant is $2$ .
The third participant starts at $4$ and finishes at $9$ . By that time the fourth participant starts, so the dissatisfaction of the third participant is $1$ .
The fourth participant starts at $6$ and finishes at $11$ . By time $11$ everyone finishes the contest, so the dissatisfaction of the fourth participant is $0$ .
In the second example the first participant starts at $0$ and finishes at time $2$ . By that time the second participants starts, and the third starts at exactly time $2$ . So the dissatisfaction of the first participant is $2$ .
The second participant starts at time $1$ and finishes at time $3$ . At that time the third participant is solving the contest.
The second participant starts at time $2$ and finishes at time $7$ . By that time the third the fourth participants start, so the dissatisfaction of the second participant is $2$ .
The third participant starts at $4$ and finishes at $9$ . By that time the fourth participant starts, so the dissatisfaction of the third participant is $1$ .
The fourth participant starts at $6$ and finishes at $11$ . By time $11$ everyone finishes the contest, so the dissatisfaction of the fourth participant is $0$ .
In the second example the first participant starts at $0$ and finishes at time $2$ . By that time the second participants starts, and the third starts at exactly time $2$ . So the dissatisfaction of the first participant is $2$ .
The second participant starts at time $1$ and finishes at time $3$ . At that time the third participant is solving the contest.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted