Aggiorna test.c
This commit is contained in:
parent
bd0893c21f
commit
f4f473b949
1 changed files with 32 additions and 34 deletions
66
test.c
66
test.c
|
|
@ -1,41 +1,39 @@
|
||||||
#include <stdint.h>
|
|
||||||
#include <gmp.h>
|
|
||||||
|
|
||||||
uint64_t fibonacci( void ) {
|
#include <stdio.h>
|
||||||
const int n = 25000;
|
#include <stdlib.h>
|
||||||
uint64_t a = 0, b = 1, c;
|
#include <string.h>
|
||||||
|
|
||||||
for (int i = 2; i <= n; i++) {
|
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
|
||||||
c = a + b;
|
|
||||||
a = b;
|
|
||||||
b = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
return b;
|
int fibonacci(int argc, char *argv[]) {
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char* fibonacci_gmp() {
|
|
||||||
const int n = 25000;
|
|
||||||
static char result[10000]; // Assicurati che sia abbastanza grande per contenere il numero
|
|
||||||
mpz_t a, b, c;
|
|
||||||
|
|
||||||
mpz_init_set_ui(a, 0);
|
char c[] = "qwertyuiopasdfghjkllzxcvbnm123456789mnbvcxzlkjhgfdsapoiuytrewq1234567890";
|
||||||
mpz_init_set_ui(b, 1);
|
|
||||||
mpz_init(c);
|
for(int a=0;a<100000;a++){
|
||||||
|
parseH(&c);
|
||||||
|
parseL(&c);
|
||||||
|
printf("%s",c);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 2; i <= n; i++) {
|
return 0;
|
||||||
mpz_add(c, a, b);
|
|
||||||
mpz_set(a, b);
|
|
||||||
mpz_set(b, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
mpz_get_str(result, 10, b);
|
|
||||||
|
|
||||||
mpz_clear(a);
|
|
||||||
mpz_clear(b);
|
|
||||||
mpz_clear(c);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void parseH(char *p){
|
||||||
|
int ln=strlen(p);
|
||||||
|
for(int a=0; a<ln; a++){
|
||||||
|
if(p[a]<123 && p[a]>96){
|
||||||
|
p[a]=p[a]-32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void parseL(char *p){
|
||||||
|
int ln=strlen(p);
|
||||||
|
for(int a=0; a<ln; a++){
|
||||||
|
if(p[a]<91 && p[a]>64){
|
||||||
|
p[a]=p[a]+32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue