結果

問題 No.239 にゃんぱすー
ユーザー card_board01
提出日時 2018-06-23 20:13:36
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 565 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 29,824 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-30 18:32:38
合計ジャッジ時間 1,187 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 16 WA * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:10:14: warning: implicit declaration of function 'calloc' [-Wimplicit-function-declaration]
   10 |     int *s = calloc(N, (unsigned)sizeof(int));
      |              ^~~~~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'calloc'
    2 | #include <string.h>
  +++ |+#include <stdlib.h>
    3 | 
main.c:10:14: warning: incompatible implicit declaration of built-in function 'calloc' [-Wbuiltin-declaration-mismatch]
   10 |     int *s = calloc(N, (unsigned)sizeof(int));
      |              ^~~~~~
main.c:10:14: note: include '<stdlib.h>' or provide a declaration of 'calloc'

ソースコード

diff #

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

int main (void) {
    unsigned N;
    scanf("%d", &N);

    char A[31];
    //int s[N] = {0};
    int *s = calloc(N, (unsigned)sizeof(int));
    int renchon = 0;
    int i, j;

    for (i = 0; i < N; i++) {
        for (j = 0; j < N; j++) {
            scanf("%s", A);
            if (strcmp(A, "nyanpass") == 0)
                s[j]++;
        }
    }

    for (j = 0; j < N; j++) {
        if (s[j] == N - 1)    renchon++;
    }

    if (renchon != 1) printf("-1");
    else  printf("n");

    // free(s);

    return 0;
}
0