CF1202D.Print a 1337-string...
普及/提高-
通过率:0%
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.
输入格式
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 ).
输出格式
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.
输入输出样例
输入#1
2 6 1
输出#1
113337 1337