QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 1024 MB 満点: 100 ハック可能 ✓

#18112. 호반우가 학교에 지각한 이유 2

統計

이세계를 모험할 때는 무기가 필요한 법이기에 호반우는 현재 신에게 받은 소수소수검의 사용법을 익히고 있다.

소수소수검을 사용하기 위해서는 검이 제시하는 두 자릿수의 소수 A, B와 양의 정수 N을 이용해 소수소수를 만들어야 한다.

소수소수란 해당 수 자체가 소수일 필요는 없지만 모든 연속된 두 자릿수가 소수인 수를 말한다.

예를 들어 973은 97과 73이 소수인 소수소수지만 937은 93이 소수가 아니기에 소수소수가 아니다.

이때 소수소수를 만들 때 한가지 제한사항이 있는데 처음 두 자릿수는 A이고 마지막 두 자릿수는 B인 N자리수의 소수소수를 만들어야 한다.

아직 검의 사용법에 익숙하지 않은 호반우를 도와 소수소수을 만들어 주자.

Input

첫 번째 줄에 A, B, N이 공백을 두고 주어진다. A, B는 두 자릿수의 소수임이 보장된다. $(7 \le N \le 100)$

Output

주어진 수들로 소수소수를 만들 수 있다면 소수소수를 아무거나 하나 출력하고 만들 수 없다면 -1을 출력한다.

Note

소수란 2 이상의 정수 중에서 1과 자기 자신으로만 나누어떨어지는 수이다.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.