Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

XOR삼각형/곽세환

From ZeroWiki
#include <iostream>
using namespace std;

int main()
{
	int ar[10][10]=Template:0;
	for (int k = 0; k < 10 - 1; k++)
		cout << " ";
	ar[0][0] = 1;
	cout << ar[0][0] << endl;
	for (int i = 1; i < 10; i++)
	{
		for (int k = 0; k < 10 - 1 - i; k++)
			cout << " ";
		for (int j = 0; j < i + 1; j++)
		{
			if (j == 0)
				ar[i][j] = 1;
			else
				ar[i][j] = (ar[i-1][j] == ar[i-1][j-1]) ? 0 : 1;
			cout << ar[i][j] << " ";
		}
		cout << "\n";
	}
	
	return 0;
}