-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.cpp
More file actions
30 lines (27 loc) · 740 Bytes
/
game.cpp
File metadata and controls
30 lines (27 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<int> A(M), B(M);
for (int i = 0; i < M; i++) {
cin >> A.at(i) >> B.at(i);
}
// ここにプログラムを追記
// (ここで"試合結果の表"の2次元配列を宣言)
vector<vector<char>> resultTable(N,vector<char>(N,'-'));
for (int i = 0; i < M; i++){
resultTable.at(A.at(i) - 1).at(B.at(i) - 1) = 'o';
resultTable.at(B.at(i) - 1).at(A.at(i) - 1) = 'x';
}
for (int i = 0;i < resultTable.size();i++){
for (int j = 0; j < resultTable.at(0).size(); j++){
cout << resultTable.at(i).at(j);
if(j == N -1){
cout << endl;
}else{
cout << '\b';
}
}
}
}