結果

問題 No.597 concat
ユーザー snow4726
提出日時 2017-12-29 13:12:49
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 427 bytes
コンパイル時間 876 ms
コンパイル使用メモリ 28,928 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-21 10:29:37
合計ジャッジ時間 708 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define LEN 20

int main(){

	char** str;
	char* moji;
	int i;
	int n;

	scanf("%d",&n);
	str = (char**)calloc(n,sizeof(char*));
	moji = (char*)calloc(LEN*n+1,sizeof(char));

	for(i=0;i<n;i++){
		str[i] = (char*)calloc(LEN+1,sizeof(char));
		scanf("%s",str[i]);
	}

	strcpy(moji,str[0]);

	for(i=1;i<n;i++){
		strcat(moji,str[i]);
	}

	printf("%s\n",moji);

	return 0;
}
0