题目意义就是今年CSP-J第三题 n≤20 的数据,但自此不知道为什么WA,附件可以AC
西西弗成绩也没拿到 n≤20 的测试点
#include<bits/stdc++.h>
using namespace std;
int t,n;
int get(int x)
{
if(x==0)
{
return 6;
}
if(x==1)
{
return 2;
}
if(x==2)
{
return 5;
}
if(x==3)
{
return 5;
}
if(x==4)
{
return 4;
}
if(x==5)
{
return 5;
}
if(x==6)
{
return 6;
}
if(x==7)
{
return 3;
}
if(x==8)
{
return 7;
}
if(x==9)
{
return 6;
}
return get(int(x/10))+get(x%10);
}
int main()
{
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(0);
cin>>t;
while(t--)
{
cin>>n;
if(n%7==0)
{
int k=n/7;
while(k--)
{
cout<<8;
}
}
else
{
if(n==1)
{
cout<<-1;
}
else
{
for(int i=0;;i++)
{
if(get(i)==n)
{
cout<<i;
break;
}
}
}
}
cout<<'\n';
}
return 0;
}