QOJ.ac

QOJ

Limite de temps : 2 s Limite de mémoire : 512 MB Points totaux : 100

#5271. 专注于成本

Statistiques

在现代电子产品中,精简冗余功能(例如移除耳机插孔)至关重要。这一趋势同样适用于计算器行业。

为了追求极简主义,Cosio 计算器公司开始生产一种仅有一个显示屏的计算器,它只能计算三角函数 $\sin, \cos, \tan$ 及其反函数 $\text{asin}, \text{acos}, \text{atan}$。

计算器初始显示数字 $0$。此后,对于上述列表中的每个函数,你可以按下一个按钮,将该函数应用于当前显示的数字。如果操作不适用或产生无穷大,计算器就会损坏并停止响应。

你接受了挑战,试图找出使用该计算器能实现的功能。请找到一种方法,在最多 $1000$ 次操作内计算出 $\frac{a}{b}$。

输入格式

仅一行,包含两个整数 $a$ 和 $b$ ($1 \le a, b \le 10$)。

输出格式

第一行输出一个整数 $k$,表示你方案中的按键次数 ($1 \le k \le 1000$)。 第二行按顺序输出所使用的操作,以空格分隔。

该方案将由一个使用 C++ 标准 64 位浮点类型 double 的程序进行检查。如果你的操作序列不会导致错误,且最终计算器显示的数值与 $\frac{a}{b}$ 的绝对误差不超过 $10^{-9}$,则你的答案被视为正确。

你不需要找到最短的方案。任何满足约束条件的方案都将被接受。

样例

样例输入 1

1 1

样例输出 1

4
atan cos sin asin

样例输入 2

2 1

样例输出 2

11
cos atan sin atan sin atan sin atan sin acos tan

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.