QOJ.ac

QOJ

実行時間制限: 2.0 s メモリ制限: 1024 MB 満点: 100

#15412. 错误的分数

統計

Felix 正在学校学习基础算术。今天他学习了除法。作为最后一项任务,他计算了一个正整数 $a$ 除以另一个正整数 $b$ 的结果。因为 $a$ 能被 $b$ 整除,所以结果是一个正整数 $c$。Felix 在笔记本上写下了 $a \div b = c$,然后出去踢足球了。

他的妹妹 Fiona 一直怀着极大的兴趣看着他学习。当 Felix 离开后,她决定对他开个小玩笑:她拿走了他的笔记本,并擦掉了等式中的“$\div$”符号。结果,等式的左边变成了一个单一的数字字符串 $s$。

当 Felix 回来时,他在笔记本上看到了 $s = c$。不幸的是,他忘记了 $a$ 和 $b$ 的原始值。现在他需要用“$\div$”符号将 $s$ 重新拆分为两部分,以恢复一个正确的除法等式。

帮助 Felix 找到正整数 $a$ 和 $b$,使得 $s$ 是 $a$ 和 $b$ 的十进制表示拼接而成的字符串,且满足 $a \div b = c$。

输入格式

唯一的一行包含一个数字字符串 $s$ 和一个整数 $c$。$s$ 和 $c$ 都由至少 $1$ 个、至多 $10^5$ 个数字组成,且不包含前导零。

输入数据保证 $s$ 是两个不含前导零的正整数 $a$ 和 $b$ 拼接而成的字符串,且满足 $a \div b = c$。

输出格式

输出两个不含前导零的正整数 $a$ 和 $b$,使得 $s$ 是 $a$ 和 $b$ 拼接而成的字符串,且满足 $a \div b = c$。如果存在多个答案,输出其中任意一个。

样例

输入样例 1

42 2

输出样例 1

4 2

输入样例 2

2025225 9

输出样例 2

2025 225

输入样例 3

239239239 1001

输出样例 3

239239 239

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.