結果
問題 | No.239 にゃんぱすー |
ユーザー | akakimidori |
提出日時 | 2015-07-10 23:22:11 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 543 bytes |
コンパイル時間 | 138 ms |
コンパイル使用メモリ | 21,760 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-08 02:18:00 |
合計ジャッジ時間 | 1,189 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
コンパイルメッセージ
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?1:0); } } } } int h=0; int index=0; for(i=0;i<N;i++){ if(p[i]==1){ h++; index=i; } } if(h==1){ printf("%d\n",index+1); } else { printf("-1\n"); } free(p); return 0; }