結果

問題 No.239 にゃんぱすー
ユーザー akakimidori
提出日時 2015-07-10 22:42:53
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 478 bytes
コンパイル時間 367 ms
コンパイル使用メモリ 21,504 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-08 02:02:40
合計ジャッジ時間 1,236 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 16 WA * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 | scanf("%d\n",&N);
      | ^~~~~~~~~~~~~~~~
main.c:24:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   24 | scanf("%s",s);
      | ^~~~~~~~~~~~~

ソースコード

diff #

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

int main(void){

int N;

scanf("%d\n",&N);

int *p;
p=(int *)malloc(sizeof(int)*N);

int i;
for(i=0;i<N;i++) p[i]=1;

char s[50];

int j;
for(i=0;i<N;i++){

for(j=0;j<N;j++){

scanf("%s",s);
if(i!=j){
int res=strcmp(s,"nyanpass");
if(p[j]==1) p[j]=(res==0);
}

}
}

int t=0;
int index=-1;

for(i=0;i<N;i++){
if(p[i]==1){
t++;
index=i;
}
}

if(t==1){
printf("%d\n",index);
} else {
printf("-1\n");
}

free(p);
return 0;
}
0