QOJ.ac

QOJ

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

#18112. 湖畔牛迟到的原因 2

統計

在异世界冒险时,武器是必不可少的,因此 Hobanwoo 目前正在学习如何使用神赐予的“素数素数剑”。

要使用素数素数剑,必须利用剑所给出的两个两位素数 $A$、$B$ 以及一个正整数 $N$ 来构造一个“素数素数”。

所谓“素数素数”,是指一个数本身不一定非要是素数,但其所有连续的两位数都必须是素数。

例如,$973$ 是一个素数素数,因为 $97$ 和 $73$ 都是素数;而 $937$ 不是素数素数,因为 $93$ 不是素数。

在构造素数素数时有一个限制:必须构造一个 $N$ 位数,其前两位必须是 $A$,最后两位必须是 $B$。

请帮助还不熟悉剑的使用方法的 Hobanwoo 构造出一个素数素数。

输入格式

第一行给出 $A$、$B$ 和 $N$,中间用空格隔开。 保证 $A$ 和 $B$ 均为两位素数。 $(7 \le N \le 100)$

输出格式

如果能用给定的数构造出素数素数,则输出任意一个符合条件的素数素数;如果无法构造,则输出 $-1$。

说明

素数是指在大于或等于 $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.