#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define u64 unsigned long long int
int main() {
u64 t,a,b,c,k,m;
int found;
a = 0;
b = 1;
k = 1;
scanf("%Lu", &t);
m = 10; while (m<t) m*=10;
found = 0;
while (!found) {
k++;
a += b;
a %= m;
c = b;
b = a;
a = c;
if (a==0 && b==1) break;
if (b == t) found = 1;
}
if (found) printf("%Lu\n", k);
else printf("NIE\n");
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #include <stdio.h> #include <stdlib.h> #include <string.h> #define u64 unsigned long long int int main() { u64 t,a,b,c,k,m; int found; a = 0; b = 1; k = 1; scanf("%Lu", &t); m = 10; while (m<t) m*=10; found = 0; while (!found) { k++; a += b; a %= m; c = b; b = a; a = c; if (a==0 && b==1) break; if (b == t) found = 1; } if (found) printf("%Lu\n", k); else printf("NIE\n"); return 0; } |
English