AGC012C 25AC,7WA求助
  • 板块学术版
  • 楼主Creeper_l
  • 当前回复0
  • 已保存回复0
  • 发布时间2023/8/5 10:34
  • 上次更新2023/11/3 05:49:06
查看原帖
AGC012C 25AC,7WA求助
436107
Creeper_l楼主2023/8/5 10:34

AGC012C

请大佬看看这份代码有什么问题。

#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 10;	
int n, cnt1, cnt2, a[MAXN], b[MAXN], num = 101; 
signed main()
{
	cin >> n; 
	while (n >= 1) {
		if (n & 1) a[++cnt1] = --num, n = (n - 1) / 2;
		else b[++cnt2] = --num, n = n - 1;
	}
	cout << (100 - num + 1) * 2 << endl;
	for (int i = 1; i <= cnt2; i++) cout << b[i] << " ";
	for (int i = cnt1; i >= 1; i--) cout << a[i] << " ";
	for (int i = num ;i <= 100; i++) cout << i << " ";
    return 0;
}

2023/8/5 10:34
加载中...