結果

問題 No.3487 Restricted Shiritori
コンテスト
ユーザー pengin_2000
提出日時 2026-04-01 22:02:28
言語 C
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 307 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,250 ms
コンパイル使用メモリ 36,420 KB
実行使用メモリ 44,260 KB
最終ジャッジ日時 2026-04-01 22:02:35
合計ジャッジ時間 3,755 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<stdio.h>
int main()
{
	char s[2], e[2];
	int n;
	scanf("%s%s", s, e);
	scanf("%d", &n);
	int i;
	if (n == 1)
	{
		if (s[0] == e[0])
			printf("%c\n", s[0]);
		else
			printf("-1\n");
	}
	else
	{
		printf("%c", s[0]);
		for (i = 2; i < n; i++)
			printf("a");
		printf("%c\n", e[0]);
	}
	return 0;
}
0