U E D R , A S I H C RSS

XOR삼각형/임다찬

~cpp
#include <stdio.h>
int xor(int front,int back){
	if(front==back)
		return 0;
	else
		return 1;

}
int main(void){
	const int MAX=50;
	int tri[MAX][MAX]={0,};
	int i,j,k;
	int col=8;

	tri[1][1]=1;
	for(i=0;i<col;i++){
		tri[i][0]=1;
		for(k=col-i;k>0;k--)
			printf(" ");
		for(j=0;j<=i;j++){
			tri[i+1][j+1]=xor(tri[i][j],tri[i][j+1]);
			printf(" %d",tri[i][j]);
		}
		printf("\n");
	}
	printf("\n");
	return 0;
}

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:27
Processing time 0.0135 sec