アットウィキロゴ

8-4t

  1. // 20084t.c
  2.  
  3. #include <stdio.h>
  4. #include <ctype.h>
  5. #include <string.h>
  6. #include <math.h>
  7. #include <stdlib.h>
  8. #include <time.h>
  9.  
  10.  
  11.  
  12. int check2(int t[N][M],int x, int y, int d){
  13.  
  14. t[x][y]=0;
  15. if(t[x-1][y]==1){
  16. check2(t,x-1,y,d+1);
  17. }
  18. if(t[x+1][y]==1){
  19. check2(t,x+1,y,d+1);
  20. }
  21. if(t[x][y+1]==1){
  22. check2(t,x,y+1,d+1);
  23. }
  24. if(t[x][y-1]==1){
  25. check2(t,x,y-1,d+1);
  26. }
  27. t[x][y]=1;
  28.  
  29. if((t[x][y+1]||t[x][y-1]||t[x+1][y]||t[x-1][y])==0){
  30.  
  31. if(d+1 > max_d){
  32.  
  33. max_d=d+1;
  34. }
  35. return(0);
  36. }
  37.  
  38.  
  39.  
  40.  
  41. int main()
  42. {
  43. printf("hoge hoge\n");
  44. return 0;
  45. }
  46.  
  47. // main 関数は正常に終了したとき return 0;
  48. // エラーが発生したときは、0 以外の数値を返すように
  49. // する習慣があるようですので、以降は return 0; に
  50. // 統一しましょう
最終更新:2009年11月24日 01:53
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。