CSP-J 模拟赛1 D Do you want to play mex again? 题解
icypenguin · · 个人记录
Substack 1
暴力搜索。
Substack 2
找规律。
#include <iostream>
#define ll long long
using namespace std;
ll n, smll = 1, bigg = 1;
int main(){
cin >> n;
smll = 2 * n - 1;
bigg = (n * (n + 1) / 2 - n) * 2 + (n + 1) / 2;
cout << smll << endl;
if (n == 1){
cout << 1 << endl;
}else if (n == 2){
cout << 3 << endl;
}else{
cout << 2 << endl;
}
cout << 0 << " ";
for (ll i = 1; i <= n - 1; i++){
cout << 1 << " ";
}
cout << endl;
cout << bigg << endl;
if (n % 2 == 1){
cout << 1 << endl;
}else{
cout << n / 2 + 2 << endl;
}
for (ll i = 1; i <= n; i++){
if (i % 2 == 1){
cout << 0 << " ";
}else{
cout << 1 << " ";
}
}
cout << endl;
return 0;
}