結果
問題 |
No.239 にゃんぱすー
|
ユーザー |
![]() |
提出日時 | 2015-07-10 23:15:11 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 537 bytes |
コンパイル時間 | 256 ms |
コンパイル使用メモリ | 21,504 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-08 02:15:48 |
合計ジャッジ時間 | 1,303 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 2 |
other | AC * 16 WA * 17 |
コンパイルメッセージ
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",&N); | ^~~~~~~~~~~~~~~~ main.c:21:25: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 21 | scanf("%s",t); | ^~~~~~~~~~~~~
ソースコード
#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,j; for(i=0;i<N;i++) p[i]=1; for(i=0;i<N;i++){ for(j=0;j<N;j++){ char t[50]; scanf("%s",t); if(i!=j){ int res=strcmp(t,"nyanpass"); if(p[j]==1){ p[j]=(res==0); } } } } int h=0; int index=0; for(i=0;i<N;i++){ if(p[j]==1){ h++; index=i; } } if(h==1){ printf("%d\n",index); } else { printf("-1\n"); } free(p); return 0; }