CF1202D.Print a 1337-string...
普及+/提高
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements.
You are given an integer n.
You have to find a sequence s consisting of digits 1,3,7 such that it has exactly n subsequences equal to 1337.
For example, sequence 337133377 has 6 subsequences equal to 1337:
- 337133377 (you can remove the second and fifth characters);
- 337133377 (you can remove the third and fifth characters);
- 337133377 (you can remove the fourth and fifth characters);
- 337133377 (you can remove the second and sixth characters);
- 337133377 (you can remove the third and sixth characters);
- 337133377 (you can remove the fourth and sixth characters).
Note that the length of the sequence s must not exceed 105.
You have to answer t independent queries.
子序列是指通过删除原序列中的一些元素(不改变剩余元素的顺序)而得到的序列。
给定一个整数 n。
你需要构造一个仅由数字 {1,3,7} 组成的序列 s,使得其恰好包含 n 个等于 1337 的子序列。
例如,序列 337133377 包含 6 个等于 1337 的子序列:
- 337133377(可删除第 2 和第 5 个字符);
- 337133377(可删除第 3 和第 5 个字符);
- 337133377(可删除第 4 和第 5 个字符);
- 337133377(可删除第 2 和第 6 个字符);
- 337133377(可删除第 3 和第 6 个字符);
- 337133377(可删除第 4 和第 6 个字符)。
注意:序列 s 的长度不得超过 105。
你需要回答 t 个相互独立的查询。
输入格式
The first line contains one integer t (1≤t≤10) — the number of queries.
Next t lines contains a description of queries: the i-th line contains one integer ni (1≤ni≤109).
第一行包含一个整数 t(1≤t≤10)—— 查询的次数。
接下来的 t 行描述了各次查询:第 i 行包含一个整数 ni(1≤ni≤109)。
输出格式
For the i-th query print one string si (1≤∣si∣≤105) consisting of digits 1,3,7. String si must have exactly ni subsequences 1337. If there are multiple such strings, print any of them.
对于第 i 个查询,输出一个仅由数字 1,3,7 组成的字符串 si(1≤∣si∣≤105),使得 si 恰好包含 ni 个子序列 1337。若存在多个满足条件的字符串,输出任意一个即可。
输入输出样例
输入#1
2 6 1
输出#1
113337 1337
输入解题思路,AI测评打分。不知道怎么写?