Created
April 15, 2016 11:09
-
-
Save AhnMo/3f27e2bca4c26cf92251b49646a71e6c 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
// acmicpc.net 1003 | |
#include <stdio.h> | |
int zero, one; | |
int fibonacci(int n) { | |
if (n==0) { | |
zero++; | |
return 0; | |
} else if (n==1) { | |
one++; | |
return 1; | |
} else { | |
return fibonacci(n - 1) + fibonacci(n - 2); | |
} | |
} | |
int main(int argc, char **argv) { | |
int p, i; | |
scanf("%d", &p); | |
for (i = 0; i < p; ++i) { | |
int j; | |
scanf("%d", &j); | |
zero = one = 0; | |
fibonacci(j); | |
printf("%d %d\n", zero, one); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment