|
发表于 2019-7-24 01:22:16
|
显示全部楼层
本帖最后由 永恒的蓝色梦想 于 2021-2-11 16:24 编辑
- from time import process_time as t
- t1=t()
- def ip(n):
- if '0' in n or len(set(n))!=9:return False
- return True
- def fib():
- a,b=1,1
- while 1:
- a,b=b,a+b
- yield str(b)
- for i in fib():
- if len(i)<=575:continue
- if ip(i[:9])and ip(i[-9:]):break
- print(f'运行结果:{str(count)}\n运行时间:{t()-t1}s')
复制代码
结果不明
[code]#include<iostream>
#include<string>
bool judge(const vector<unsigned char>& s)noexcept {
char* str;
unsigned char n;
union {
unsigned char digits[10];
struct {
unsigned long long a;
unsigned short b;
} x;
} x;
str = s.c_str();
x.x.b = x.x.a = 0;
for (n = 9; n; n--) {
x.digits[*str]++;
str++;
}
if ((x.x.a - (unsigned long long)0b0000000100000001000000010000000100000001000000010000000100000001) & (x.x.b - (unsigned short)0b100000001)) {
return false;
}
str = s.c_str();
void add(vector<unsigned char>& a, const vector<unsigned char>& b)noexept {
size_t n;
for (n = b.size() - a.size(); n; n--) {
a.push_back('0');
}
for (n = 0; n < a.size() - 1;) {
a[n] += b[n];
if (a[n] > 9) {
a[n] -= 10;
a[++n]++;
}
}
int main() {
using namespace std;
ios::sync_with_stdio(false);
vector<unsigned char> a = { 1 }, b = { 1 };
while (a.size() <= 18) {
add(a, b);
swap(a, b);
}
for (;;) {
}
} |
|