Difficult-Rocket/try/c/feb_speed.c

32 lines
635 B
C
Raw Normal View History

2022-06-08 20:31:48 +08:00
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
int64_t feb(int64_t* cache, int32_t count)
{
2022-06-14 20:52:03 +08:00
if ((count == 1) + (count == 0)) {
2022-06-08 20:31:48 +08:00
return 1;
};
2022-06-14 20:52:03 +08:00
if (cache[count] == 0) {
return cache[count];
};
cache[count] = feb(cache, --count) + feb(cache, --count);
return cache[count];
2022-06-08 20:31:48 +08:00
};
int main()
{
2022-06-14 20:52:03 +08:00
int32_t count;
printf("<EFBFBD>٣<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD><EFBFBD><EFBFBD>̫<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
2022-06-08 20:31:48 +08:00
scanf("%d", &count);
2022-06-14 20:52:03 +08:00
printf("<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %d <20><>feb\n", count);
int64_t* cache;
cache = calloc(count, sizeof(int64_t));
int64_t result = feb(cache, count);
printf("%d", result);
2022-06-08 20:31:48 +08:00
return 0;
}