CF1295A.Display The Number

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You have a large electronic screen which can display up to 998244353998244353 decimal digits. The digits are displayed in the same way as on different electronic alarm clocks: each place for a digit consists of 77 segments which can be turned on and off to compose different digits. The following picture describes how you can display all 1010 decimal digits:

As you can see, different digits may require different number of segments to be turned on. For example, if you want to display 11, you have to turn on 22 segments of the screen, and if you want to display 88, all 77 segments of some place to display a digit should be turned on.

You want to display a really large integer on the screen. Unfortunately, the screen is bugged: no more than nn segments can be turned on simultaneously. So now you wonder what is the greatest integer that can be displayed by turning on no more than nn segments.

Your program should be able to process tt different test cases.

你有一块大型电子显示屏,最多可显示 998244353998244353 位十进制数字。这些数字的显示方式与各类电子闹钟相同:每个数位由 77 个可独立开启或关闭的线段组成,通过不同线段的组合来表示不同的数字。下图描述了全部 1010 个十进制数字的显示方式:

如图所示,不同数字所需的点亮线段数量可能不同。例如,要显示数字 11,需点亮 22 个线段;而要显示数字 88,则需点亮某个数位上的全部 77 个线段。

你想在该屏幕上显示一个非常大的整数。但不幸的是,屏幕存在故障:任意时刻点亮的线段总数不能超过 nn 个。因此,你现在想知道:在点亮线段总数不超过 nn 的前提下,所能显示的最大整数是多少?

你的程序需要能够处理 tt 组不同的测试用例。

输入格式

The first line contains one integer tt (1≤t≤1001 \le t \le 100) — the number of test cases in the input.

Then the test cases follow, each of them is represented by a separate line containing one integer nn (2≤n≤1052 \le n \le 10^5) — the maximum number of segments that can be turned on in the corresponding testcase.

It is guaranteed that the sum of nn over all test cases in the input does not exceed 10510^5.

第一行包含一个整数 tt(1≤t≤1001 \le t \le 100)—— 输入中测试用例的数量。

接下来是各测试用例,每个测试用例由一行单独的整数 nn(2≤n≤1052 \le n \le 10^5)表示—— 即对应测试用例中最多可点亮的线段数量。

保证输入中所有测试用例的 nn 值之和不超过 10510^5。

输出格式

For each test case, print the greatest integer that can be displayed by turning on no more than nn segments of the screen. Note that the answer may not fit in the standard 3232-bit or 6464-bit integral data type.

对于每个测试用例,输出通过点亮屏幕上至多 nn 个线段所能显示的最大整数。注意:答案可能无法放入标准的 3232 位或 6464 位整型数据类型中。

输入输出样例

  • 输入#1

    2
    3
    4

    输出#1

    7
    11

输入解题思路,AI测评打分。不知道怎么写?

首页