CF70C.Lucky Tickets

提高+/省选-

通过率:0%

时间限制:1.50s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

In Walrusland public transport tickets are characterized by two integers: by the number of the series and by the number of the ticket in the series. Let the series number be represented by a and the ticket number — by b, then a ticket is described by the ordered pair of numbers (a, b).

The walruses believe that a ticket is lucky if a * b = rev(a) * rev(b). The function rev(x) reverses a number written in the decimal system, at that the leading zeroes disappear. For example, rev(12343) = 34321, rev(1200) = 21.

The Public Transport Management Committee wants to release x series, each containing y tickets, so that at least w lucky tickets were released and the total number of released tickets (x * y) were minimum. The series are numbered from 1 to x inclusive. The tickets in each series are numbered from 1 to y inclusive. The Transport Committee cannot release more than max__x series and more than max__y tickets in one series.

在海象国,公共交通车票由两个整数表征:系列编号与该系列内的票号。设系列编号为 aa,票号为 bb,则一张车票由有序对 (a, b)(a,\,b) 描述。

海象们认为一张车票是“幸运的”,当且仅当满足 a×b=rev(a)×rev(b)a \times b = \text{rev}(a) \times \text{rev}(b)。其中函数 rev(x)\text{rev}(x) 表示将十进制表示的数 xx 的各位数字反转(反转后去除前导零)。例如,rev(12343)=34321\text{rev}(12343) = 34321,rev(1200)=21\text{rev}(1200) = 21。

公共交通管理委员会计划发行 xx 个系列,每个系列包含 yy 张车票,要求至少发行 ww 张幸运车票,且总发行车票数 x×yx \times y 最小。系列编号从 11 到 xx(含端点),每个系列内的车票编号从 11 到 yy(含端点)。交通委员会最多只能发行 max_x\text{max\_x} 个系列,且每个系列最多只能包含 max_y\text{max\_y} 张车票。

输入格式

The first line contains three integers max__x, max__y, w (1 ≤ max__x, max__y ≤ 105, 1 ≤ w ≤ 107).

第一行包含三个整数 max_x\text{max\_x}、max_y\text{max\_y}、ww(1 ≤ max_x, max_y ≤ 1051 \leq \text{max\_x}, \text{max\_y} \leq 10^5,1 ≤ w ≤ 1071 \leq w \leq 10^7)。

输出格式

Print on a single line two space-separated numbers, the x and the y. If there are several possible variants, print any of them. If such x and y do not exist, print a single number  - 1.

在一行中输出两个用空格分隔的数字,即 xx 和 yy。如果存在多种可能的解,输出任意一个即可。如果不存在满足条件的 xx 和 yy,则输出单个数字 −1-1。

输入输出样例

  • 输入#1

    2 2 1

    输出#1

    1 1
  • 输入#2

    132 10 35

    输出#2

    7 5
  • 输入#3

    5 18 1000

    输出#3

    -1
  • 输入#4

    48 132 235

    输出#4

    22 111

输入解题思路,AI测评打分。不知道怎么写?

首页