Created
April 24, 2014 07:31
-
-
Save kaneshin/11244992 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define N 1000 | |
void initialize(long long int *r, long long int *s, long long int *y, long long int *x); | |
int | |
main(int argc, char* argv[]) | |
{ | |
// z: k + 1 | |
// y: k | |
// x: k - 1 | |
long long int z, y, x = 0; | |
long long int i, r, s; | |
initialize(&r, &s, &y, &x); | |
for (i = 0; i < N; ++i) | |
{ | |
z = y + r * x + s; | |
printf("%lld\t: %lld, %lld, %lld\n", i, z, y, x); | |
x = y; | |
y = z; | |
} | |
return 0; | |
} | |
void | |
initialize(long long int *r, long long int *s, long long int *y, long long int *x) | |
{ | |
*r = 1; | |
*s = 0; | |
*y = 1; | |
*x = 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment