CF301C.Yaroslav and Algorithm
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Yaroslav likes algorithms. We'll describe one of his favorite algorithms.
- The algorithm receives a string as the input. We denote this input string as a.
- The algorithm consists of some number of command. Сommand number i looks either as s__i >> w__i, or as s__i <> w__i, where s__i and w__i are some possibly empty strings of length at most 7, consisting of digits and characters "?".
- At each iteration, the algorithm looks for a command with the minimum index i, such that s__i occurs in a as a substring. If this command is not found the algorithm terminates.
- Let's denote the number of the found command as k. In string a the first occurrence of the string s__k is replaced by string w__k. If the found command at that had form s__k >> w__k, then the algorithm continues its execution and proceeds to the next iteration. Otherwise, the algorithm terminates.
- The value of string a after algorithm termination is considered to be the output of the algorithm.
Yaroslav has a set of n positive integers, he needs to come up with his favorite algorithm that will increase each of the given numbers by one. More formally, if we consider each number as a string representing the decimal representation of the number, then being run on each of these strings separately, the algorithm should receive the output string that is a recording of the corresponding number increased by one.
Help Yaroslav.
亚罗斯拉夫喜欢算法。下面我们介绍他最喜爱的算法之一。
- 该算法以一个字符串作为输入。我们将此输入字符串记为 a。
- 该算法由若干条命令组成。第 i 条命令的形式为 si≫wi 或 si≪wi,其中 si 和 wi 均为长度至多为 7 的字符串(可能为空),且仅由数字字符和字符
?组成。 - 在每次迭代中,算法查找下标最小的命令 i,使得 si 作为子串出现在 a 中。若未找到这样的命令,则算法终止。
- 设找到的命令编号为 k。将字符串 a 中 sk 的首次出现替换为字符串 wk。若该命令形如 sk≫wk,则算法继续执行,并进入下一次迭代;否则(即命令形如 sk≪wk),算法终止。
- 算法终止后所得的字符串 a 即为该算法的输出。
亚罗斯拉夫有一组 n 个正整数。他需要设计出他最喜爱的上述算法,使得该算法能将给定的每个数均加一。更准确地说:若将每个数视作其十进制表示所对应的字符串,则当该算法分别作用于这些字符串时,对每个输入字符串所产生的输出字符串,应恰好是对应数字加一后的十进制表示。
请帮助亚罗斯拉夫。
输入格式
The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the set. The next n lines contains one positive integer each. All the given numbers are less than 1025.
第一行包含一个整数 n(1≤n≤100)—— 表示集合中元素的个数。接下来的 n 行每行包含一个正整数。所有给定的数均小于 1025。
输出格式
Print the algorithm which can individually increase each number of the set. In the i-th line print the command number i without spaces.
Your algorithm will be launched for each of these numbers. The answer will be considered correct if:
- Each line will a correct algorithm command (see the description in the problem statement).
- The number of commands should not exceed 50.
- The algorithm will increase each of the given numbers by one.
- To get a respond, the algorithm will perform no more than 200 iterations for each number.
输出一个算法,该算法可对集合中的每个数分别执行加一操作。在第 i 行输出第 i 条命令(命令之间不包含空格)。
该算法将被依次应用于给定的每个数字。当满足以下条件时,答案视为正确:
- 每一行均为一条合法的算法指令(参见题目描述中的指令说明);
- 指令总数不超过 50 条;
- 该算法可使每个给定的数字均增加 1;
- 对每个数字执行该算法时,迭代次数不超过 200 次。
输入输出样例
输入#1
2 10 79
输出#1
10<>11 79<>80
输入解题思路,AI测评打分。不知道怎么写?