Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions code/BOJ/no.10870/no.10870_정재현.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main{
public static void main(String[] args) throws IOException {

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int result = Fibonacci(n);
System.out.println(result);
}
public static int Fibonacci(int n){
if(n==0) return 0;
if(n==1) return 1;
return Fibonacci(n-1) + Fibonacci(n-2);
}
}
20 changes: 20 additions & 0 deletions code/BOJ/no.10872/no.10872_정재현.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int x = Integer.parseInt(br.readLine());

int sum = factorial(x);
System.out.println(sum);

}

public static int factorial(int x){
if(x<=1) return 1;

return x * factorial(x-1);
}
}
31 changes: 31 additions & 0 deletions code/BOJ/no.11729/no.11729_정재현.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import java.util.Scanner;

public class Main{

public static StringBuilder sb = new StringBuilder();

public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int N = in.nextInt();

sb.append((int)(Math.pow(2,N)-1)).append('\n');

Hanoi(N,1,2,3);
System.out.println(sb);
}

public static void Hanoi(int N, int start, int mid, int end){
if(N==1){
sb.append(start + " " + end + "\n");
return;
}
//n-1개 start->mid
Hanoi(N-1, start, end, mid);

//1개 start->end
Hanoi(1, start, mid, end);

//n-1개 mid->end
Hanoi(N-1, mid, start, end);
}
}
51 changes: 51 additions & 0 deletions code/BOJ/no.2447/no.2447_정재현.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import java.util.Scanner;

public class Main {
static char[][] arr;

public static void main(String[] args) {
Scanner in = new Scanner (System.in);
int N = in.nextInt();

arr = new char[N][N];

star(0,0,N,false);

StringBuilder sb = new StringBuilder();
for(int i = 0; i<N; i++) {
for(int j=0; j<N; j++) {
sb.append(arr[i][j]);
}
sb.append('\n');
}
System.out.print(sb);
}

static void star(int x, int y, int N, boolean blank) {
if(blank) {
for(int i = x; i<x+N; i++ ) {
for(int j = y; j<y+N; j++) {
arr[i][j]=' ';
}
}
return;
}

if(N==1) {
arr[x][y]='*';
return;
}

int size = N/3;
int count = 0;
for(int i=x; i<x+N; i+=size) {
for(int j=y; j<y+N; j+=size) {
count++;
if(count==5) {
star(i,j,size,true);
}
else { star(i,j,size,false);}
}
}
}
}