問題一覧 > 通常問題

No.3487 Restricted Shiritori

レベル : / AI推定難易度 : 124 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 1024 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (AC するまで非表示) / 解いたユーザー数 112
作問者 : sclara / テスター : 👑 p-adic UT0911
お気に入りにしたユーザー ProblemId : 13141 / 自分の提出
問題文最終更新日: 2026-03-31 11:56:56
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder April Fool Contest 2026 (順位表) の他の問題:

Problem Statement

You are given lowercase English letters $s$ and $e$, and a positive integer $N$.
Output one string of $N$ lowercase English letters that starts with $s$ and ends with $e$.
If no such string exists, output -1.

Input

$s$ $e$ $N$

  • $s$ and $e$ are each a single lowercase English letter
  • $1 \leq N \leq 10$
  • $N$ is an integer

Output

If there are multiple answers, output any one of them.
If no answer exists, output -1.

Sample

Sample 1
Input
c t 3
Output
cat

cat is a string of $3$ lowercase English letters that starts with c and ends with t.

Sample 2
Input
q g 10
Output
qawsedrftg

The string does not have to be a word found in a dictionary.

Sample 3
Input
s h 1
Output
-1

There is no string of $1$ lowercase English letter that starts with s and ends with h.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。