結果

問題 No.239 にゃんぱすー
ユーザー くれちー
提出日時 2016-08-25 00:34:08
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 455 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 21,248 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-08 02:11:46
合計ジャッジ時間 1,388 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%d", &n);
      |         ^~~~~~~~~~~~~~~
main.c:11:25: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |                         scanf("%s", a[i][j]);
      |                         ^~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <string.h>

int main() {
	char a[100][100][31];
	int n, cnt[100] = {}, cnt2 = 0, renge, i, j;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			scanf("%s", a[i][j]);
			if (strcmp(a[i][j], "nyanpass") == 0) {
				cnt[j]++;
			}
		}
	}

	for (i = 0; i < n; i++) {
		if (cnt[i] == n - 1) {
			cnt2++;
			renge = i + 1;
		}
	}

	if (cnt2 != 1) printf("-1\n");
	else printf("%d\n", renge);
	
	return 0;
}
0