所以这题的正解是啥?
  • 板块灌水区
  • 楼主wky_wsy
  • 当前回复4
  • 已保存回复4
  • 发布时间2025/2/6 10:29
  • 上次更新2025/2/6 13:45:34
查看原帖
所以这题的正解是啥?
1323415
wky_wsy楼主2025/2/6 10:29

话说可以加入主题库吗,因为这玩意把 DeepSeek 硬控了 10 分钟
题目传送门(加入我主页的团队后报名 XTOI'R1才能开。。)
目前可以通过的 std:

#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#define int long long
using namespace std;
struct ttree{
	int a;
	ttree *l;
	ttree *r;
};
ttree *head,*r;

void stree(int a,ttree *ead){
	ttree *lp,*rp;
	if(a==0) return ;
	lp=new ttree;
	rp=new ttree;
	lp->a=a;
	rp->a=a; 
	ead->l=lp;
	ead->r=rp;
	stree(a-1,lp);
	stree(a-1,rp);
}
void outtree(int a,ttree *ead){
	if(a==0) return ;
	ttree *lp,*rp;
	cout<<ead->a<<' ';
	lp=ead->l;
	rp=ead->r;
	outtree(a-1,lp);
	outtree(a-1,rp);
}
signed main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	head=new ttree;
	int n;
	cin>>n;
	head->a=n;
	stree(n-1,head);
	outtree(n,head);
	return 0;
}

但是感觉这题不学图论也能做

2025/2/6 10:29
加载中...