AcWing 6040. 小木棍
原题链接
中等
作者:
魔仙哥
,
2024-12-20 14:23:30
,
所有人可见
,
阅读 3
打表
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define F(i,a,b) for(int i=a;i<=b;i++)
int T,n;
int calc(int x)
{
if(x == 1) return -1;
if(x == 2) return 1;
if(x == 3) return 7;
if(x == 4) return 4;
if(x == 5) return 2;
if(x == 6) return 6;
if(x == 7) return 8;
if(x == 8) return 10;
if(x == 9) return 18;
if(x == 10) return 22;
if(x == 11) return 20;
if(x == 12) return 28;
if(x == 13) return 68;
if(x == 14) return 88;
if(x == 15) return 108;
if(x == 16) return 188;
if(x == 17) return 200;
if(x == 18) return 208;
if(x == 19) return 288;
if(x == 20) return 688;
}
int main()
{
cin>>T;
while(T--)
{
cin>>n;
int cnt = 0;
while(n >= 21)
{
cnt++;
n -= 7;
}
cout << calc(n);
while(cnt--) cout<<8;
cout<<'\n';
}
return 0;
}