ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

A. Display The Number

2020-01-30 20:42:00  阅读:261  来源: 互联网

标签:segments Number Display integer test input screen display


time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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.

Input

The first line contains one integer tt (1≤t≤1001≤t≤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≤n≤105) — 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 105105.

Output

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.

Example

input

Copy

2
3
4

output

Copy

7
11

解题说明:此题是一道模拟题,仔细分析能发现1和7这两个数字消耗的segment最少,于是尽量选择1和7即可。



#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>

using namespace std;

int main() 
{
	int t;
	scanf("%d", &t);
	while (t--) 
	{
		int n, x;
		scanf("%d", &n);
		if (n % 2 == 0) 
		{
			x = n / 2;
			while (x--)
			{
				printf("1");
			}
		}
		else 
		{
			printf("7");
			x = (n - 3) / 2;
			while (x--)
			{
				printf("1");
			}
		}
		printf("\n");
	}
	return 0;
}

 

Felven 发布了1734 篇原创文章 · 获赞 372 · 访问量 273万+ 他的留言板 关注

标签:segments,Number,Display,integer,test,input,screen,display
来源: https://blog.csdn.net/jj12345jj198999/article/details/104118468

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有