1
#include <cstdio>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
// a positive integer n not greater than 10^18
//所以换最多18*2个
int main()
{
int k;
int x=8,y=9;
cin>>k;
if(k>36)
printf("-1\n");
else
{
if(k%2)
{
cout<<y;
}
k/=2;
while(k--)
cout<<x;
}
return 0;
}
本文介绍了一个有趣的数学问题:如何找到一个不超过10^18的正整数n,使得其十进制表示中恰好包含k个环。环是指阿拉伯数字书写形式中封闭的平面区域,例如数字4有一个环,而数字8有两个环。文章提供了一种算法解决方案。

3647

被折叠的 条评论
为什么被折叠?



