[GESP202506 二级] 幂和数

Luogu
IDLGB4357
Time1000ms
Memory512MB
DifficultyP2
2025进制循环结构GESP
对于正整数 $n$,如果 $n$ 可以表为两个 $2$ 的次幂之和,即 $n = 2^x + 2^y$($x, y$ 均为非负整数),那么称 $n$ 为幂和数。 给定正整数 $l, r$,请你求出满足 $l \leq n \leq r$ 的整数 $n$ 中有多少个幂和数。 ## Input 一行,两个正整数 $l, r$,含义如上。 ## Output 输出一行,一个整数,表示 $l, r$ 之间幂和数的数量。 [samples] ## Background 对应的选择、判断题:<https://ti.luogu.com.cn/problemset/1182> ## Note 对于所有测试点,保证 $1 \leq l \leq r \leq 10^4$。
Samples
Input #1
2 8
Output #1
6
Input #2
10 100
Output #2
20
API Response (JSON)
{
  "problem": {
    "name": "[GESP202506 二级] 幂和数",
    "description": {
      "content": "对于正整数 $n$,如果 $n$ 可以表为两个 $2$ 的次幂之和,即 $n = 2^x + 2^y$($x, y$ 均为非负整数),那么称 $n$ 为幂和数。 给定正整数 $l, r$,请你求出满足 $l \\leq n \\leq r$ 的整数 $n$ 中有多少个幂和数。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P2"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGB4357"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "对于正整数 $n$,如果 $n$ 可以表为两个 $2$ 的次幂之和,即 $n = 2^x + 2^y$($x, y$ 均为非负整数),那么称 $n$ 为幂和数。\n\n给定正整数 $l, r$,请你求出满足 $l \\leq n \\leq r$ 的整数 $n$ 中有多少个幂和数。\n\n## Input\n\n一行,两个正整数 $l, r$,含义如上。\n\n## Output\n\n输出一行,一个整数,表示 $l, ...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments