fork download
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int d[1002];
  7.  
  8. int main() {
  9. int n;
  10. scanf("%d" ,&n);
  11.  
  12. d[0] = 1;
  13. d[1] = 1;
  14. for (int i = 2; i <= n; i++) {
  15. d[i] = d[i - 1] + d[i - 2];
  16. d[i] = d[i]%10007;
  17. }
  18. printf("%d\n", d[n]);
  19. return 0;
  20.  
  21. }
Success #stdin #stdout 0s 4516KB
stdin
9
stdout
55