U E D R , A S I H C RSS

XOR삼각형/aekae

~cpp 
#include <iostream> 
using namespace std; 
 
const int MAX = 8;
 
int main() 
{ 
        int arr[MAX][MAX]; 
        for (int i=0; i<MAX; i++) 
        { 
                arr[i][0] = 1; 
                arr[i][i] = 1; 
        } 
		
        int j,k; 
        for (j=1; j<MAX; j++) 
        { 
                for (k=0; k<MAX; k++) 
                { 
                        if (j == k+1) 
                                break; 
                        if (arr[j-1][k] == arr[j-1][k+1]) 
                                arr[j][k+1] = 0; 
                        else 
                                arr[j][k+1] = 1; 
                } 
        } 
		for (j=0; j<MAX; j++)
		{
			for (int h=j; h<MAX-1; h++)
				cout << ' ';
			for (k=0; k<j+1; k++)
				cout << arr[j][k] << ' ';
			cout << "\n";
		}
        return 0;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:27
Processing time 0.0292 sec