logo AlgoBeat OnlineJudge
登录 注册

#213725. [NWRRC 2022] Focusing on Costs

内存限制:512 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

In modern gadgets, it's crucial to trim down the fat and get rid of unnecessary features, like a headphone jack. The same trend applies to the calculator industry.

In their pursuit for minimalism, Cosio calculator company started to produce calculators that have a single display and can only compute trigonometric functions and their inverses .

Initially, the calculator's display shows the number . After that, for each of the functions listed above, you can press a button that applies that function to the displayed number. If the operation is inapplicable or produces infinity, then the calculator breaks and stops responding.

You took it as a challenge to figure out what you can achieve using this calculator. Find a way to compute using at most operations.

输入格式

The only line contains two integers and ().

输出格式

In the first line, print a single integer --- the number of button presses in your solution ().

In the second line, print the applied operations in order, separated by spaces.

The solution will be checked with a program in C++ using the standard 64-bit floating-point type: . Your answer will be considered correct if the sequence of actions does not cause an error, and in the end the calculator displays with an absolute error of at most .

You do not have to find the shortest solution. Any solution satisfying the constraints will be accepted.

样例

样例输入 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