Advertisement
Guest User

Untitled

a guest
Mar 28th, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. //
  2. // main.c
  3. // 개미
  4. //
  5. // Created by 성시철 on 2015. 3. 29..
  6. // Copyright (c) 2015년 성시철. All rights reserved.
  7. //
  8.  
  9. #include <stdio.h>
  10.  
  11. int main(int argc, const char * argv[]) {
  12. int a[100][100] = {0};
  13. a[0][0] = 1;
  14. for (int i=0; i<99; i++) {
  15. int count = 0;
  16. int temp = a[i][0];
  17. int point = 0;
  18. for (int j=0; j<99; j++) {
  19. if (a[i][j] == temp) {
  20. count ++;
  21. }
  22. else {
  23. a[i+1][point] = temp;
  24. a[i+1][point+1] = count;
  25. point += 2;
  26. count = 1;
  27. temp = a[i][j];
  28. }
  29. if (temp == 0) {
  30. break;
  31. }
  32. }
  33. }
  34. for (int i=0; i<10; i++) {
  35. for (int j=0; j<100; j++) {
  36. if (a[i][j]) {
  37. printf("%d", a[i][j]);
  38. }
  39. }
  40. printf("\n");
  41. }
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement