結果
問題 |
No.239 にゃんぱすー
|
ユーザー |
![]() |
提出日時 | 2017-04-05 18:51:06 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 583 bytes |
コンパイル時間 | 156 ms |
コンパイル使用メモリ | 24,960 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-08 10:52:41 |
合計ジャッジ時間 | 1,055 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d", &N); | ~~~~~^~~~~~~~~~ main.cpp:16:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%s", A[i][j]); | ~~~~~^~~~~~~~~~~~~~~
ソースコード
#include <stdlib.h> #include <stdio.h> #include <string.h> #define UREP(i,n) for(unsigned i = 0; i < (n); i++) int main(){ unsigned N; scanf("%d", &N); char ***A; A = (char ***)malloc(sizeof(char **) * N); UREP(i, N){ A[i] = (char **)malloc(sizeof(char *) * N); UREP(j, N){ A[i][j] = (char *)malloc(32); scanf("%s", A[i][j]); } } unsigned ren, count = 0, all; UREP(i, N){ all = 1; UREP(j, N){ if(i != j && strcmp(A[j][i], "nyanpass")) all = 0; } if(all){ ren = i; count++; } } if(count == 1) printf("%d\n", ren + 1); else printf("-1\n"); }