[蓝桥杯 2023 国 A] XYZ

Luogu
IDLGP10416
Time1000ms
Memory256MB
DifficultyP3
数学2023蓝桥杯国赛
给定一个区间 $[L,R]$,请求出有多少组 $X,Y,Z$ 满足 $X+Y=Z$ 且 $L\le X,Y,Z\le R$。 ## Input 本题包含多组询问。 输入的第一行包含一个整数 $T$ 表示询问组数。 接下来 $T$ 行,每行包含两个整数 $L_i,R_i$,用一个空格分隔,表示一组询问。 ## Output 输出 $T$ 行,每行包含一个整数,表示满足条件的 $X,Y,Z$ 的组数。 [samples] ## Note **【样例解释 1】** $1+1=2$ $1+2=3$ $2+1=3$ $1+3=4$ $2+2=4$ $3+1=4$ **【评测用例规模与约定】** 对于 $30\%$ 的评测用例,$T\le 1000$,$L_i,R_i\le 100$。 对于所有评测用例,$1\le T\le 100000$,$1\le L_i\le R_i\le 10^9$。
Samples
Input #1
2
1 3
1 4
Output #1
3
6
API Response (JSON)
{
  "problem": {
    "name": "[蓝桥杯 2023 国 A] XYZ",
    "description": {
      "content": "给定一个区间 $[L,R]$,请求出有多少组 $X,Y,Z$ 满足 $X+Y=Z$ 且 $L\\le X,Y,Z\\le R$。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": {
      "LuoguStyle": "P3"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGP10416"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "给定一个区间 $[L,R]$,请求出有多少组 $X,Y,Z$ 满足 $X+Y=Z$ 且 $L\\le X,Y,Z\\le R$。\n\n## Input\n\n本题包含多组询问。\n\n输入的第一行包含一个整数 $T$ 表示询问组数。\n\n接下来 $T$ 行,每行包含两个整数 $L_i,R_i$,用一个空格分隔,表示一组询问。\n\n## Output\n\n输出 $T$ 行,每行包含一个整数,表示满足条件的 $X,Y,Z...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments