#B4261. [GESP202503 三级] 2025

[GESP202503 三级] 2025

B4261 [GESP202503 三级] 2025

  • 题号:B4261
  • 难度:入门(1)
  • 标签:2025、枚举、位运算、GESP
  • 时间限制:1000 ms
  • 内存限制:512 MB
  • 样例数:1
  • 提交 / 通过:50227 / 34891
  • 抓取时间:2026-11-11T08:53:23.460Z
  • 正文来源:problem.content(zh-CN)

题目背景

对应的选择、判断题:https://ti.luogu.com.cn/problemset/1175

题目描述

小 A 有一个整数 xx,他想找到最小的正整数 yy 使得下式成立:

$$(x \ \operatorname{and} \ y) + (x \ \operatorname{or} \ y) = 2025$$

其中 and⁡\operatorname{and} 表示二进制按位与运算,or⁡\operatorname{or} 表示二进制按位或运算。如果不存在满足条件的 yy,则输出 −1-1。

输入格式

一行,一个整数 xx。

输出格式

一行,一个整数,若满足条件的 yy 存在则输出 yy,否则输出 −1-1。

样例

样例 1 输入

1025

样例 1 输出

1000

提示

对于所有测试点,保证 0≤x<20250 \leq x < 2025。

$$(x \ \operatorname{and} \ y) + (x \ \operatorname{or} \ y) = 2025$$

其中:

  • and⁡\operatorname{and} 表示按位与运算,运算符为 &\&。
  • or⁡\operatorname{or} 表示按位或运算,运算符为 ∣|。

由 fetch_luogu_statements.mjs v1.0.0 自动抓取生成;原始数据见 json/B4261.json。