fork(1) download
  1. #include <cstdio>
  2. using namespace std;
  3.  
  4. inline int fibonacci(int n) {
  5. return (const int []) {0,
  6. 1, 1, 2, 3, 5, 8, 13, 21, 34, 55,
  7. 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765,
  8. 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040,
  9. 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155} [n];
  10. }
  11.  
  12. int main() {
  13. static unsigned int T;
  14. if(scanf("%u", &T) < 1)
  15. return 1;
  16. while(T--) {
  17. int N;
  18. if(scanf("%d", &N) < 1)
  19. return 1;
  20. printf("%d %d\n", fibonacci(N - 1), fibonacci(N));
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0s 3100KB
stdin
1
5
stdout
3 5