Cod sursa(job #2591892)

Utilizator shantih1Alex S Hill shantih1 Data 31 martie 2020 17:11:46
Problema Oras Scor 55
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <iostream>
#include <fstream>

using namespace std;
ifstream fin("oras.in");
ofstream fout("oras.out");

int main() {

	int n = 0;
	fin >> n;
	if (n % 2 == 0) {
		fout << -1 << "\n";
		return 0;
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			int r = (j - i) % 2;
			if (j < i)  r = (i - j + 1) % 2;
			if (j > i)	r = (j - i) % 2;	
			fout << r;
		}
		fout << "\n";
	}
	return 0;
}