#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int N;
int graph[101][101];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> N;
for (int i = 1; i <= N; i++) {
for (int k = 1; k <= N; k++) {
int value; cin >> value;
graph[i][k] = value;
}
}
for (int k = 1; k <= N; k++) {
for (int a = 1; a <= N; a++) {
for (int b = 1; b <= N; b++) {
if (graph[a][k] && graph[k][b]) graph[a][b] = 1;
}
}
}
for (int a = 1; a <= N; a++) {
for (int b = 1; b <= N; b++) {
cout << graph[a][b]<<' ';
}
cout << "\n";
}
}
'Algorithm ๐ง๐ปโ๐ป > ๋ฐฑ์ค(BOJ)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค,c++] 11444๋ฒ - ํผ๋ณด๋์น์ 6 (0) | 2021.10.28 |
---|---|
[๋ฐฑ์ค,c++] 11441๋ฒ - ํฉ ๊ตฌํ๊ธฐ (0) | 2021.10.27 |
[๋ฐฑ์ค,c++] 11404๋ฒ - ํ๋ก์ด๋ (0) | 2021.10.27 |
[๋ฐฑ์ค,c++] 11399๋ฒ - ATM (0) | 2021.10.27 |
[๋ฐฑ์ค,c++] 1138๋ฒ - ํ ์ค๋ก ์๊ธฐ (0) | 2021.10.27 |
[๋ฐฑ์ค,c++] 11365๋ฒ - !๋ฐ๋น ๊ธ์ผ (0) | 2021.10.27 |
๋๊ธ