tutorial:问题可以简化成
n
=
c
n
t
1
∗
C
c
n
t
3
2
∗
n
3
n = cnt_1 * C_{cnt_3}^2* n_3
n=cnt1∗Ccnt32∗n3,且
c
n
t
1
+
c
n
t
3
+
c
n
t
7
≤
1
0
5
cnt_1 + cnt_3 + cnt_7 \leq10^5
cnt1+cnt3+cnt7≤105, 怎么办, 且注意到
c
n
t
3
cnt_3
cnt3这个数占权最大, 肯定越多越好, 那
c
n
t
3
cnt_3
cnt3最多是多少呢, 考虑
C
x
2
≥
1
0
5
C_{x}^2 \geq10^5
Cx2≥105,
x
x
x大约是1e4数量级的, 现在就最大化
c
n
t
3
cnt_3
cnt3就好了, 余下的部分用
c
n
t
7
cnt_7
cnt7补在第一个
133
133
133后面, 然后接333333…337;
#include<bits/stdc++.h>usingnamespace std;#define _rep(i, a, b) for (int i = (a); i <= (b); ++i)#define _rev(i, a, b) for (int i = (a); i >= (b); --i)#define _for(i, a, b) for (int i = (a); i < (b); ++i)#define _rof(i, a, b) for (int i = (a); i > (b); --i)#define oo 0x3f3f3f3f#define ll long long#define db double#define eps 1e-8#define bin(x) cout << bitset<10>(x) << endl;#define what_is(x) cerr << #x << " is " << x << "s" << endl;#define met(a, b) memset(a, b, sizeof(a))#define all(x) x.begin(), x.end()#define pii pair<int, int>intnxt(){int ret;scanf("%d",&ret);return ret;}
string s;intmain(){int t =nxt();_rep(i,1, t){
ll n =nxt();if(n ==1){
cout <<"1337"<< endl;continue;}
n *=2;
ll n3 =sqrt(n);while(n3 *(n3 -1)<= n)n3++;
n3--;
ll left =(n - n3 *(n3 -1))/2;
s ="133";_rep(i,1, left) s.append("7");_rep(i,1, n3 -2) s.append("3");
s.append("7");
cout << s << endl;//cout << s.size() << endl;}}