Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.c
- // 개미
- //
- // Created by 성시철 on 2015. 3. 29..
- // Copyright (c) 2015년 성시철. All rights reserved.
- //
- #include <stdio.h>
- int main(int argc, const char * argv[]) {
- int a[100][100] = {0};
- a[0][0] = 1;
- for (int i=0; i<99; i++) {
- int count = 0;
- int temp = a[i][0];
- int point = 0;
- for (int j=0; j<99; j++) {
- if (a[i][j] == temp) {
- count ++;
- }
- else {
- a[i+1][point] = temp;
- a[i+1][point+1] = count;
- point += 2;
- count = 1;
- temp = a[i][j];
- }
- if (temp == 0) {
- break;
- }
- }
- }
- for (int i=0; i<10; i++) {
- for (int j=0; j<100; j++) {
- if (a[i][j]) {
- printf("%d", a[i][j]);
- }
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement