hdu-6862 Hexagon 图形运动找规律


#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<queue>
#include<ctime>
#include<algorithm>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const ll INF = 1e18;
inline int read(){
    int x=0,f=1;char c=getchar();
    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
    for(;isdigit(c);c=getchar()) x=x*10+c-'0';
    return x*f;
}
void dfs(int n)
{
	if(n<=1) 
	{
		return ;
	}
	else if(n==2)
	{
		printf("345613"); 
		return ;
	}
	else
	{
		int m = n-2;
		printf("3");
		while(m--) printf("42");
		
		m = n-2;
		printf("4");
		while(m--) printf("53");
		
		m = n-2;
		printf("5");
		while(m--) printf("64");
		
		m = n-2;
		printf("6");
		while(m--) printf("15");
		
		m = n-2;
		printf("1");
		while(m--) printf("26");
		
		m = n-3;
		printf("23");
		while(m--) printf("13");
		
		printf("4");
		dfs(n-2);
	} 
}
int main()
{
	int tt;cin>>tt;
	while(tt--)
	{
		int n;cin>>n;
		dfs(n);
		printf("\n");
	}
}
/*
n=2
3 4 5 6 1 3
n=3
342 453 564 615 126 23 (4)
n=4
34242 45353 56464 61515 12626 2313 (4)
n=5
3424242 4535353 5646464 6151515 1262626 231313 (4)

342453564615126234
342453564615126234
342424535356464615151262623134345613
342424535356464615151262623234345613
*/


posted @ 2020-08-14 17:46  特立独行的猪猪  阅读(176)  评论(0编辑  收藏  举报