Skip to content

Commit

Permalink
13923 오버워치 월드컵
Browse files Browse the repository at this point in the history
  • Loading branch information
cjy8922 authored May 2, 2021
1 parent d24c7ce commit 0526c97
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions 2021_05/BJ_13923.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include<iostream>
#include<vector>
using namespace std;

// 알파벳 총 26개
// 아스키코드 'A' 는 17, Z'는 42

char seat[26][26]; // 좌석 배치
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);

int n; // 팀의 개수
while (cin >> n)
{
vector<int> rowsum(n);
vector<int> colsum(n);
string tmp;
for (int i = 0; i < n; i++) {
cin >> tmp;
for (int j = 0; j < n; j++) {
seat[i][j] = tmp[j];
rowsum[i] += tmp[j], colsum[j] += tmp[j];
}
}

int goodSum, badrow = -1, badcol = -1;
if (rowsum[0] != rowsum[1]) goodSum = rowsum[2];
else goodSum = rowsum[0];

for (int i = 0; i < n; i++)
if (rowsum[i] != goodSum) badrow = i;
for (int j = 0; j < n; j++)
if (colsum[j] != goodSum) badcol = j;

int badchar = seat[badrow][badcol];
int badSum = rowsum[badrow];
cout << badrow + 1 << " " << badcol + 1 << " " << (char)(goodSum - (badSum - badchar)) << endl;
}

return 0;
}

0 comments on commit 0526c97

Please sign in to comment.