Skip to content

Commit

Permalink
20180215
Browse files Browse the repository at this point in the history
  • Loading branch information
suhyeonjin committed Feb 16, 2018
1 parent 8da1eb2 commit 8ee4319
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Baekjoon/10867.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Exercise 10867
"""
10
1 4 2 3 1 4 2 3 1 2
"""
count = input()
num_list = raw_input().split(' ')
num_list = map(int, num_list)
num_list = list(set(num_list))
num_list.sort()

for i in num_list:
print i,
Binary file added Baekjoon/10870
Binary file not shown.
67 changes: 67 additions & 0 deletions Baekjoon/10870.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#include <stdio.h>
#include <stdlib.h>

static int *Fibonacci_array = 0;
static int tmp_malloc_size = 0;

int Fibonacci_function(int num)
{
int num_tmp = num;
int result =1;
int cnt = 1;
int tmp = 1;
int i = 1;

//Calc Fibornacci
Fibonacci_array = (int*)malloc(sizeof(int)*num_tmp);

Fibonacci_array[0] = 0;
Fibonacci_array[1] = 1;

if (num == 0){
tmp_malloc_size = 1;
return 0;
}

else if (num == 1){
tmp_malloc_size = 2;
return 0;
}


while (i < num){
// printf("%d ",result);
Fibonacci_array[i] = result;
i++;

tmp = result;
result += cnt;
cnt = tmp;
}

//set malloc size
tmp_malloc_size = i;
return 0;
}



int main(int argc, char *argv[]){

int T;
scanf("%d", &T);
Fibonacci_function(T);

Fibonacci_array[0] = 0;
Fibonacci_array[1] = 1;
printf("%d\n", Fibonacci_array[tmp_malloc_size-1]);


// for (int j=0;j< tmp_malloc_size;j++){
// printf("%d,", Fibonacci_array[j]);
// }

//malloc free
free(Fibonacci_array);
return 0;
}

0 comments on commit 8ee4319

Please sign in to comment.