結果
問題 |
No.239 にゃんぱすー
|
ユーザー |
![]() |
提出日時 | 2015-07-10 22:46:08 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 475 bytes |
コンパイル時間 | 174 ms |
コンパイル使用メモリ | 25,216 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-08 02:03:32 |
合計ジャッジ時間 | 1,193 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 2 |
other | AC * 16 WA * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:6: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d\n",&N); | ~~~~~^~~~~~~~~~~ main.cpp:22:6: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 22 | scanf("%s",s); | ~~~~~^~~~~~~~
ソースコード
#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; int j; for(i=0;i<N;i++){ for(j=0;j<N;j++){ char s[50]; 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; }