This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
int n = sc.nextInt(); | |
int m = sc.nextInt(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
char[][] input = new char[5][15]; | |
int max_length = Integer.MIN_VALUE; | |
for(int i = 0; i < 5; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Main { | |
public static int nThree; | |
public static int answer; | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
int n = sc.nextInt(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
for(int j = 0; j < 3; j++) { | |
int cnt = 0; | |
for(int i = 0; i < 4; i++) { | |
int num = sc.nextInt(); | |
if(num == 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
int A = sc.nextInt(); | |
int B = sc.nextInt(); | |
int C = sc.nextInt(); | |
int ans = A * B * C; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.Scanner; | |
class Edge implements Comparable<Edge>{ | |
int v1; | |
int v2; | |
int cost; | |
Edge(int v1, int v2, int cost) { | |
this.v1 = v1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.Scanner; | |
class Edge implements Comparable<Edge> { | |
int v1; | |
int v2; | |
int cost; | |
Edge(int v1, int v2, int cost) { | |
this.v1 = v1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Collections; | |
class Edge implements Comparable<Edge> { | |
int v1; | |
int v2; | |
int cost; | |
Edge(int v1, int v2, int cost) { | |
this.v1 = v1; | |
this.v2 = v2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Main { | |
public static int answer = 0; | |
public static StringBuilder sb = new StringBuilder(); | |
// from에 꽂혀있는 num개의 원반을 by를 거쳐 to로 이동한다. | |
public static void moveHanoiTower(int num, int from, int by, int to) { | |
++answer; | |
// 이동할 원반의 수가 1개라면? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from에 꽂혀있는 num개의 원반을 by를 거쳐 to로 이동한다. | |
public static void moveHanoiTower(int num, int from, int by, int to) { | |
// 이동할 원반의 수가 1개라면? | |
if(num == 1) { | |
System.out.println("원반" + num + "을 " + from + "에서 " + to +"로 이동"); | |
} else { | |
// STEP 1 : num-1개를 A에서 B로 이동 | |
moveHanoiTower(num-1, from, to, by); | |
// STEP 2 : 1개를 A에서 C로 이동 | |
System.out.println("원반" + num + "을 " + from + "에서 " + to +"로 이동"); |