結果

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

ソースコード

diff #

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

int main(void){
	int i,j,n;
	char s[110][110];
	
	int rentyon = -1;
	scanf("%d", &n);
	
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			char str[50];
			scanf("%s", str);
			if(strcmp(str, "nyanpass") == 0){
				s[i][j] = 1;
			}else{
				s[i][j] = 0;
			}
		}
	}
	
	for(j=1;j<=n;j++){
		int tmp = 0;
		for(i=1;i<=n;i++){
			tmp += s[i][j];
		}
		if(tmp == (n-1)){
			if(rentyon != -1){
				rentyon = -1;
				j=i=n;
				break;
			}else{
				rentyon = j;
			}
		}
	}
	
	printf("%d\n", rentyon);
	
	return 0;
}
0