G325031. [GESP202503 三级 C++] 26. 2025

提交1 通过1
通过率100%
时间限制1000ms
内存限制512MiB
    ID: 190 传统题 1000ms 512MiB 尝试: 1 已通过: 1 难度: 普及- 上传者: 标签>进制转换与位运算编程题c++位运算枚举1星

题目描述

题目描述

小 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
$$(x \ \operatorname{and} \ y) + (x \ \operatorname{or} \ y) = 2025$$

其中:

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

数据范围

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