题解:P13836 微观戏剧(Constructive ver.)
Charged_Charge · · 题解
洛谷 P13836
解题思路:
首先,我们要先做出 P11275 这道题。根据前面题目的结论:
AC 代码:
#include<bits/stdc++.h>
#define int long long
using namespace std;
int q;
signed main() {
cin >> q;
while (q--) {
int x;
cin >> x;
if (x == 0) {
cout << "1 1" << endl;
} else if (x == 1) {
cout << "-1 -1" << endl;
} else if (x < 1e18) {
cout << 1 << " " << x << endl;
} else {
if (x % 2 == 1) {
cout << x / 2 << " " << x / 2 + 1 << endl;
} else {
cout << x / 2 - 1 << " " << x / 2 + 1 << endl;
}
}
}
return 0;
}