2020 Multi-University Training Contest 4---- HDU--6813、 Last Problem （构造）

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<string>
#include<queue>
#include<bitset>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<set>
#include<ctime>
#define ui unsigned int
#define ll long long
#define llu unsigned ll
#define ld long double
#define pr make_pair
#define pb push_back
//#define lc (cnt<<1)
//#define rc (cnt<<1|1)
#define len(x)  (t[(x)].r-t[(x)].l+1)
#define tmid ((l+r)>>1)
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)>(y)?(y):(x))
using namespace std;

const int inf=0x3f3f3f3f;
const ll lnf=0x3f3f3f3f3f3f3f3f;
const double dnf=1e18;
const double alpha=0.75;
const int mod=1e9+7;
const double eps=1e-8;
const double pi=acos(-1.0);
const int hp=13331;
const int maxn=2100;
const int maxm=100100;
const int maxp=100100;
const int up=1100;

int ha[maxn][maxn];

void dfs(int x,int y,int n)
{
if(n<=0) return ;
if(ha[x][y]==n) return ;
dfs(x-1,y,n-1);
dfs(x,y-1,n-2);
dfs(x,y+1,n-3);
dfs(x+1,y,n-4);
ha[x][y]=n;
printf("%d %d %d\n",x,y,n);
}

int main(void)
{
int n;
scanf("%d",&n);
dfs(1000,1000,n);
return 0;
}


• 点赞
• 评论
• 分享
x

海报分享

扫一扫，分享海报

• 收藏
• 手机看

分享到微信朋友圈

x

扫一扫，手机阅读

• 打赏

打赏

_Shmily

你的鼓励将是我创作的最大动力

C币 余额
2C币 4C币 6C币 10C币 20C币 50C币
• 一键三连

点赞Mark关注该博主, 随时了解TA的最新博文
10-24

08-18 1808
08-10 1015
08-16 1464