[ROIR 2022] 幼儿园的新年 (Day 2)

Luogu
IDLGP10090
Time1000ms
Memory128MB
DifficultyP4
数学2022Special JudgeROIR(俄罗斯)
给出三个整数 $n,a,b$,求有多少对 $(x,y)$ 满足 $0 \le x \le a$,$0 \le y \le b$,$x+y$ 不为 $0$ 且能被 $n$ 整除。 ## Input 本题多测,第一行输入一个整数 $t$,表示测试数据的组数。 接下来的 $t$ 行,每行输入一组测试数据 $n,a,b$,由空格隔开。 ## Output 对于每组数据,输出一行一个数字,即符合条件的 $(x,y)$ 数量。 [samples] ## Background 翻译简化自 [ROIR 2022 D2T1](https://neerc.ifmo.ru/school/archive/2021-2022/ru-olymp-regional-2022-day2.pdf)。 ## Note 本题使用捆绑测试。 | 子任务 | 分值 | 特殊性质 | | :----------: | :----------: | :----------: | | $1$ | $10$ | $t=1$ 且 $a,b\le1000$ | | $2$ | $10$ | $t\le1000$ 且 $a=0$ | | $3$ | $15$ | $t\le1000$ 且 $a,b<n\le1000$ | | $4$ | $10$ | $t\le1000$ 且 $a,b\le1000$ | | $5$ | $15$ | $t=1$ 且 $n\le1000$ | | $6$ | $10$ | $t\le1000$ 且 $n\le1000$ | | $7$ | $30$ | 无特殊性质 | 对于 $100\%$ 的数据,$1 \le t \le 10^5$,$4 \le n \le 10^9$,$0 \le a, b \le 10^9$。
Samples
Input #1
4
4 2 2
4 4 4
6 5 5
8 13 17
Output #1
1
6
5
30
API Response (JSON)
{
  "problem": {
    "name": "[ROIR 2022] 幼儿园的新年 (Day 2)",
    "description": {
      "content": "给出三个整数 $n,a,b$,求有多少对 $(x,y)$ 满足 $0 \\le x \\le a$,$0 \\le y \\le b$,$x+y$ 不为 $0$ 且能被 $n$ 整除。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 131072
    },
    "difficulty": {
      "LuoguStyle": "P4"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGP10090"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "给出三个整数 $n,a,b$,求有多少对 $(x,y)$ 满足 $0 \\le x \\le a$,$0 \\le y \\le b$,$x+y$ 不为 $0$ 且能被 $n$ 整除。\n\n## Input\n\n本题多测,第一行输入一个整数 $t$,表示测试数据的组数。\n\n接下来的 $t$ 行,每行输入一组测试数据 $n,a,b$,由空格隔开。\n\n## Output\n\n对于每组数据,输出一行一个数字,即符合条...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments