본문 바로가기

전체 글169

백준 11725 트리의 부모 찾기 import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Main { static int parents []; static ArrayList list []; public static void main(String[] args) { try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); //arrayList 한 원소를 배열로... 배열의 한 원소가 어레이리스트인듯 list =new ArrayList [n+1]; for(int i=0;i 2021. 8. 26.
백준 1697 숨바꼭질 import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); //수빈의 위치 int k=sc.nextInt(); //동생의 위치 boolean visited []=new boolean [100001]; Arrays.fill(visited, false); visited[n]=true; //걸음수를 넣는 배열 int status[]=new int [100001]; status[0]=n; Queue q =new Li.. 2021. 8. 25.
백준 7569 토마토2 import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Main { public static int nx []= {1,-1,0,0,0,0}; public static int ny []= {0,0,-1,1,0,0}; public static int nz []= {0,0,0,0,-1,1}; public static void main(String[] args) { Scanner sc=new Scanner(System.in); int m=sc.nextInt(); int n=sc.nextInt(); int h=sc.nextInt(); int[][][] arr = new int[m][n][h]; .. 2021. 8. 24.
백준 7576 토마토 import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Main { public static int nx []= {1,-1,0,0}; public static int ny []= {0,0,-1,1}; public static void main(String[] args) { Scanner sc=new Scanner(System.in); int m=sc.nextInt(); int n=sc.nextInt(); int arr [][]=new int [m+2][n+2]; int arr2 [][]=new int [m+2][n+2]; boolean check [][]=new boolean[m+2][.. 2021. 8. 23.
백준 1302 베스트셀러 import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); HashMap map =new HashMap(); String arr []=new String[n]; for(int i=0;i 2021. 8. 20.
백준 9012 괄호 import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); Stack stack = new Stack(); StringBuilder st=new StringBuilder(); BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); try { int n=Integer.parseInt(br.readLine()); for(int i=0;i 2021. 8. 19.
반응형