Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>>
- using namespace std;
- void displayMatrix(int matrix[1000][1000], int n);
- void getSolution(int p, int matrix[1000][1000]);
- void displayNumberOfSwapsToTransformToChessBoard(int matrix[1000][1000]);
- void checkIfMatrixCanBeChessBoard(int matrix[1000][1000]);
- void findMinSwapsToTransformToChessBoard(int matrix[1000][1000]);
- int main()
- {
- ifstream fin("polihroniade.in");
- // ofstream fout("polihroniade.out");
- int p, t;
- fin >> p >> t;
- int currentScenario = 1;
- while (currentScenario <= t)
- {
- int n;
- fin >> n;
- int matrix[1000][1000] = {0};
- for (int i = 0; i < n; i++)
- {
- char line[n];
- fin >> line;
- for (int j = 0; j < n; j++)
- {
- matrix[i][j] = line[j] - '0';
- }
- }
- //displayMatrix(matrix, n); // asta e doar de verificare sa vezi daca ti-a citit cum trebuie
- getSolution(p, matrix);
- currentScenario++;
- }
- return 0;
- }
- void displayMatrix(int matrix[1000][1000], int n) {
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < n; j++) {
- cout << matrix[i][j] << " ";
- }
- cout << endl;
- }
- cout << endl << endl;
- }
- void getSolution(int p, int matrix[1000][1000]) {
- switch (p) {
- case 1:
- checkIfMatrixCanBeChessBoard(matrix);
- break;
- case 2:
- findMinSwapsToTransformToChessBoard(matrix);
- break;
- case 3:
- displayNumberOfSwapsToTransformToChessBoard(matrix);
- break;
- default:
- break;
- }
- }
- void checkIfMatrixCanBeChessBoard(int matrix[1000][1000]) {
- cout << "Aici vom implementa daca matricea poate sa fie sau nu o tabla de sah" << endl;
- }
- void findMinSwapsToTransformToChessBoard(int matrix[1000][1000]) {
- cout << "Aici vom afla numarul minim de transformari pe care le putem face ca sa transforma in tabla de sah" << endl;
- }
- void displayNumberOfSwapsToTransformToChessBoard(int matrix[1000][1000]) {
- cout << "Aici vom face ultima cerinta, anume cand P = 3" << endl;
- }
Add Comment
Please, Sign In to add comment