话不多说,直接上代码
#include <iostream>
#include <cmath>
using namespace std;
unsigned long long a[510] = {0, 1}, t;
int p;
int main()
{
cin >> p;
cout << (int)(p * log10(2)) + 1 << endl;
for (; p >= 0; p -= 60)
{
t = 0;
for (int j = 1; j <= 500; j++)
{
if (p >= 60) a[j] <<= 60;
else a[j] <<= p;
a[j] += t;
t = a[j] / 10;
a[j] %= 10;
}
}
a[1] -= 1;
for (int i = 500; i >= 1; i--)
{
cout << (char)('0' + a[i]);
if (i % 50 == 1) cout << endl;
}
return 0;
}