結果
| 問題 |
No.43 野球の試合
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-09 12:53:42 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,130 bytes |
| コンパイル時間 | 248 ms |
| コンパイル使用メモリ | 30,464 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-11 02:58:12 |
| 合計ジャッジ時間 | 806 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | WA * 7 |
ソースコード
#include <stdio.h>
#include <stdlib.h>
int check(int[7][7], int, int);
int main(int argc, const char * argv[]) {
int i, j, n;
int s[7][7];
char d[7];
scanf("%d", &n);
for (j = 0; j < n; j++) {
scanf("%s", d);
for (i = 0; i < n; i++) {
if (d[i] == '-')
s[j][i] = 0;
else if (d[i] == 'x')
s[j][i] = -1;
else if (d[i] == 'o')
s[j][i] = 1;
else
s[j][i] = 9;
}
}
printf("%d ", check(s, n, 1));
printf("%d\n", check(s, n, -1));
return EXIT_SUCCESS;
}
int check(int d[7][7], int n, int a) {
int i, j, r = 0;
int c[7][7], num[7] = {0, 0, 0, 0, 0, 0, 0};
for (j = 0; j < n; j++) {
for (i = 0; i < n; i++) {
if (j < i) {
if (d[j][i] == 0)
c[j][i] = a;
else
c[j][i] = d[j][i];
}
else {
if (d[j][i] == 0)
c[j][i] = -1;
else
c[j][i] = d[j][i];
}
}
}
for (j = 0; j < n; j++) {
for (i = 0; i < n; i++) {
if (d[j][i] == 1)
num[j]++;
}
}
for (j = 1; j < n; j++)
if (num[0] < num[j])
r++;
return r;
}