提交时间:2023-05-20 17:25:17
运行 ID: 74200
#include<bits/stdc++.h> using namespace std; long long k=1,t,b[30]={-1,-1,2,7,4,3,6,8,10,18,22,21,28,58,78,108,178,201,208,278,688,778,1078}; string ax,in,a[10]={"777","108","177","200","208","277","577"}; int main(){ cin>>k; if(k<22)cout<<b[k]; else { ax=a[k%7]; for(int i=1;i<=(k-1)/7-3;i++)ax=ax+"8"; ax=ax+"8"; cout<<ax; }if(k&1)in="7",k-=3; for(int i=1;i<=k>>1;i++)in+="1"; cout<<" "<<in; return 0; }