#include <stdio.h>
const int COUNT = 1000;
const int LENGTH = 1000;
void Evaluation(int to[], int from[]);
void Change_b(int b[], int temp_b[]);
void Add(int c[], int a[], int b[]);
void Fun(int s[]);
int Length(int s[]);
int main(int argc, const char *argv[])
{
int a[LENGTH] = {0};
int b[LENGTH] = {0};
a[LENGTH - 1] = 1;
b[LENGTH - 1] = 2;
int temp_b[LENGTH] = {0};
int number;
temp_b[LENGTH - 1] = 1;
number = 0;
for (int i = 1; i != COUNT; ++i)
{
Evaluation(a, b);
Change_b(b, temp_b);
Fun(b);
int c[LENGTH] = {0};
Add(c, a, b);
Fun(c);
if (Length(c) - Length(b) > 0)
++number;
Evaluation(temp_b, a);
}
printf("Number: %d\n", number);
return 0;
}
void Evaluation(int to[], int from[])
{
for (int i = 0; i != LENGTH; ++i)
{
to[i] = from[i];
}
}
void Change_b(int b[], int temp_b[])
{
for (int i = LENGTH - 1; i >= 0 ; --i)
{
b[i] = 2 * b[i] + temp_b[i];
}
}
void Add(int c[], int a[], int b[])
{
for (int i = 0; i != LENGTH; ++i)
{
c[i] = a[i] + b[i];
}
}
void Fun(int s[])
{
for (int i = LENGTH - 1; i >= 0; --i)
{
if (s[i] > 9)
{
s[i - 1] += s[i] / 10;
s[i] %= 10;
}
}
}
int Length(int s[])
{
for (int i = 0; i != LENGTH; ++i)
{
if (s[i] != 0)
{
return LENGTH - i + 1;
}
}
return 0;
}
// 答案:153
const int COUNT = 1000;
const int LENGTH = 1000;
void Evaluation(int to[], int from[]);
void Change_b(int b[], int temp_b[]);
void Add(int c[], int a[], int b[]);
void Fun(int s[]);
int Length(int s[]);
int main(int argc, const char *argv[])
{
int a[LENGTH] = {0};
int b[LENGTH] = {0};
a[LENGTH - 1] = 1;
b[LENGTH - 1] = 2;
int temp_b[LENGTH] = {0};
int number;
temp_b[LENGTH - 1] = 1;
number = 0;
for (int i = 1; i != COUNT; ++i)
{
Evaluation(a, b);
Change_b(b, temp_b);
Fun(b);
int c[LENGTH] = {0};
Add(c, a, b);
Fun(c);
if (Length(c) - Length(b) > 0)
++number;
Evaluation(temp_b, a);
}
printf("Number: %d\n", number);
return 0;
}
void Evaluation(int to[], int from[])
{
for (int i = 0; i != LENGTH; ++i)
{
to[i] = from[i];
}
}
void Change_b(int b[], int temp_b[])
{
for (int i = LENGTH - 1; i >= 0 ; --i)
{
b[i] = 2 * b[i] + temp_b[i];
}
}
void Add(int c[], int a[], int b[])
{
for (int i = 0; i != LENGTH; ++i)
{
c[i] = a[i] + b[i];
}
}
void Fun(int s[])
{
for (int i = LENGTH - 1; i >= 0; --i)
{
if (s[i] > 9)
{
s[i - 1] += s[i] / 10;
s[i] %= 10;
}
}
}
int Length(int s[])
{
for (int i = 0; i != LENGTH; ++i)
{
if (s[i] != 0)
{
return LENGTH - i + 1;
}
}
return 0;
}
// 答案:153