B.
题意:给出一个整数n,将从1开始前n个整数换分成两部分,判断两部分各自的和是否为互质数
思路是,首先求出前n个整数和sum,然后让 i 从1到n遍历,判断 i 和 sum 的最大公约数
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;
const int xa = 1e5 + 10;
int a[30];
bool cmp(int a, int b) {
return a < b;
}
int mo(int n) {
int sum = 0;
for (int i = 0; i <= n; i++) {
sum += i;
}
return sum;
}
int gcd(int a, int b)
{
int r;
while (b > 0)
{
r = a % b;
a = b;
b = r;
}
return a;
}
int main() {
int n;
cin >> n;
int sum = mo(n);
for (int i = 2; i <= n; i++) {
if (gcd(sum - i, i) != 1) {
cout << "Yes" << endl;
cout << "1 " << i << endl;
cout << n - 1 << " ";
for (int j = 1; j <= n; j++) {
if (j == i) continue;
cout << j << " ";
}
return 0;
}
}
cout << "No" << endl;
}