結果

問題 No.239 にゃんぱすー
ユーザー suppy193
提出日時 2015-07-13 09:43:12
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 570 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 21,504 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-08 06:39:16
合計ジャッジ時間 1,015 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d", &n);
      |         ^~~~~~~~~~~~~~~
main.c:13:25: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |                         scanf("%s", greeting[i][j]);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

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

int main(void) {
	int i, j, n;
	char greeting[101][101][31];
	int nyanpass[101] = {0};
	int renchon;
	int count;
	scanf("%d", &n);
	for(i = 0;i < n;i++){
		for(j = 0;j < n;j++){
			scanf("%s", greeting[i][j]);
			if(i == j){
				continue;
			}
			if(strcmp(greeting[i][j], "nyanpass") != 0){
				nyanpass[j] = 1;
			}
		}
	}
	renchon = -1;
	count = 0;
	for(j = 0;j < n;j++){
		if(nyanpass[j] == 0){
			count++;
			renchon = j;
		}
	}
	if(count == 1){
		printf("%d\n", renchon + 1);
	}
	else{
		printf("-1\n");
	}
	
    return 0;
}
0