剪邮票
本文最后更新于 1966 天前,其中的信息可能已经有所发展或是发生改变。
#include<iostream>
#include<cstring>
#define MAX 10000
using namespace std;
int count=0;
int arr_total[MAX][3][4];
int judge(int arr[3][4]){
	//cout<<"--------judge-------"<<endl;
//	for(int i=0;i<3;i++){			
//		for(int j=0;j<4;j++){
//			cout<<arr[i][j]<<"  ";						
//		}
//		cout<<endl;
//	}
//	cout<<endl;	
	if(count==0){
		//cout<<"1ok"<<endl;
		return 1;
	}
	for(int i=0;i<count;i++){
		int temp_judge=0;
		for(int j=0;j<3;j++){
			for(int k=0;k<4;k++){
				if(arr_total[i][j][k]==arr[j][k]){					
					temp_judge++;
				}
			}
		}
		if(temp_judge==12){
			//cout<<"no"<<endl;
			return 0;
		}
	}
	//cout<<"2ok"<<endl;
	return 1;
}
void dg(int arr[3][4],int step,int x,int y){
	//cout<<"step"<<step<<endl;
	if(step==5&&judge(arr)){		
		count++;		
		for(int i=0;i<3;i++){			
			for(int j=0;j<4;j++){
				cout<<arr[i][j]<<"  ";				
				arr_total[count-1][i][j]=arr[i][j];
			}
			cout<<endl;
		}
		cout<<endl;
		return;
	}
	if(step>5){
		return;
	}
	arr[x][y]=1;
	if(x-1>=0&&arr[x-1][y]==0){
		dg(arr,step+1,x-1,y);
	}
	if(x+1<3&&arr[x+1][y]==0){
		dg(arr,step+1,x+1,y);
	}
	if(y-1>=0&&arr[x][y-1]==0){
		dg(arr,step+1,x,y-1);
	}
	if(y+1<4&&arr[x][y+1]==0){
		dg(arr,step+1,x,y+1);
	}
	arr[x][y]=0;
}
int main(){
	int arr[3][4];
	memset(arr,0,sizeof(arr));
	for(int i=0;i<3;i++){
		for(int j=0;j<4;j++){
			cout<<"i========="<<i<<"j========="<<j<<endl;
			dg(arr,0,i,j);
			cout<<"count:"<<count<<endl;
			//count=0;
		}
	}
	
	return 0;
}
作者:Yuyy
博客:https://yuyy.info
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇