1 条题解
-
0
众所周知,方程 的整数解只能是 ,因此答案不大于 ,讨论答案即可。
#include <bits/stdc++.h> using namespace std; int a[200012]; map<int, int> p; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { int x; cin >> x; p[x] = 1; } for (map<int, int>::iterator s = p.begin(); s != p.end(); s++) for (int j = 0; j <= 30; j++) if (p.count((s -> first) - (1 << j)) && p.count((s -> first) + (1 << j))) { cout << 3 << endl; cout << (s -> first) - (1 << j) << ' ' << (s -> first) << ' ' << (s -> first) + (1 << j) << endl; return 0; } for (map<int, int>::iterator s = p.begin(); s != p.end(); s++) for (int j = 0; j <= 30; j++) if (p.count((s -> first) + (1 << j))) { cout << 2 << endl; cout << (s -> first) << ' ' << (s -> first) + (1 << j) << endl; return 0; } cout << 1 << endl; cout << ((p.begin()) -> first) << endl; return 0; }
信息
- ID
- 82
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 3
- 标签
- 递交数
- 4
- 已通过
- 2
- 上传者