其实这道题就是 看数字有几个圈,比如0 4 6 9 有一个圈 8 有两个圈,输出结果不能超过10^18也就是不能有超过36个圈
#include <cstdio> #include <cstring> #include <algorithm> #include <vector> #include <math.h> #include <string.h> #include <algorithm> #include <iostream> #include <string> #include <iostream> #include <time.h> #include <queue> #include <list> #include <map> #include <set> #include <vector> #include <stack> #include <bitset> using namespace std; int main() { int k; cin>>k; if(k>36) cout<<"-1"<<endl; else{ if(k%2==0){ for(int i=0;i<k/2;i++) cout<<"8"; cout<<endl; } else{ for(int i=0;i<k/2;i++) cout<<"8"; cout<<"9"<<endl;; } } return 0; }