fork download
  1. #include <stdio.h>
  2.  
  3. int rec(int n){
  4.  
  5. if (n==0){
  6. return 3;
  7. }
  8.  
  9. else if (n==1){
  10. return 0;
  11. }
  12.  
  13. else if(n==2){
  14. return 2;
  15. }
  16.  
  17. else {
  18. return rec(n-2)+rec(n-3);}
  19.  
  20. }
  21.  
  22. int main(void){
  23. int n=50;
  24. for(int i=1;i<=50;i++){
  25. int val=rec(i);
  26. if(val%i==0){
  27. printf("第%dの時の値は%d\n",i,val);
  28. }
  29. }
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0.02s 5204KB
stdin
Standard input is empty
stdout
第1の時の値は0
第2の時の値は2
第3の時の値は3
第5の時の値は5
第7の時の値は7
第11の時の値は22
第13の時の値は39
第17の時の値は119
第19の時の値は209
第23の時の値は644
第29の時の値は3480
第31の時の値は6107
第37の時の値は33004
第41の時の値は101639
第43の時の値は178364
第47の時の値は549289