Advertisement
yarin

Untitled

Mar 28th, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int ant[10][20];
  6. int i, j, k;
  7. int count=1;
  8. int num;
  9. for(i=0; i<10; i++)
  10. {
  11. for(j=0; j<20; j++)
  12. {
  13. ant[i][j] = 0;
  14. }
  15. }
  16. ant[0][0] = 1;
  17. for(i=0; i<9; i++)
  18. {
  19. for(j=0; j<20; j++)
  20. {
  21. if(ant[i][j]==0)
  22. {
  23. }
  24. else if(ant[i][j]!=ant[i][j+1])
  25. {
  26. num = ant[i][j];
  27. for(k=0; k<20; k++)
  28. {
  29. if(ant[i+1][k]==0)
  30. {
  31. ant[i+1][k]=num;
  32. ant[i+1][k+1]=count;
  33. count=1;
  34. break;
  35. }
  36. }
  37. }
  38. else
  39. {
  40. count++;
  41. }
  42. }
  43. }
  44. for(i=0; i<10; i++)
  45. {
  46. for(j=0; j<20; j++)
  47. {
  48. if(ant[i][j]!=0) printf("%d", ant[i][j]);
  49. }
  50. printf("\n");
  51. }
  52. return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement