結果

問題 No.597 concat
ユーザー Elk
提出日時 2018-06-03 13:35:57
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 319 bytes
コンパイル時間 134 ms
コンパイル使用メモリ 23,168 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-30 09:20:05
合計ジャッジ時間 732 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 WA * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |     scanf("%d\n", &N);
      |     ~~~~~^~~~~~~~~~~~
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%s ", str[i]);
      |         ~~~~~^~~~~~~~~~~~~~~
main.cpp:14:26: warning: ‘%s’ directive writing up to 209 bytes into a region of size between 1 and 1000 [-Wformat-overflow=]
   14 |         sprintf(str2, "%s%s", str2, str[i]);
      |                          ^~
In file included from /usr/include/stdio.h:894,
                 from main.cpp:1:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:38:34: note: ‘__builtin___sprintf_chk’ output between 1 and 1209 bytes into a destination of size 1000
   38 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   39 |                                   __glibc_objsize (__s), __fmt,
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   40 |                                   __va_arg_pack ());
      |                                   ~~~~~~~~~~~~~~~~~

ソースコード

diff #

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

int main(){
    int i, N;
    char str[10][21];
    char str2[1000];

    scanf("%d\n", &N);
    for(i = 0; i < N; i++){
        scanf("%s ", str[i]);
    }
    for(i = 0; i < N; i++){
        sprintf(str2, "%s%s", str2, str[i]);
    }
    printf("%s\n", str2);

    return 0;
}
0