목록Problem Solving (223)
Life Engineering
https://www.acmicpc.net/problem/2661 2661번: 좋은수열 첫 번째 줄에 1, 2, 3으로만 이루어져 있는 길이가 N인 좋은 수열들 중에서 가장 작은 수를 나타내는 수열만 출력한다. 수열을 이루는 1, 2, 3들 사이에는 빈칸을 두지 않는다. www.acmicpc.net import java.util.*; public class P2661 { static String ans=""; static int[] nums= {1,2,3}; static int N=-1; public static void main(String[] args) { Scanner sc=new Scanner(System.in); N=sc.nextInt(); backtracking(0,""); System.out..
https://www.acmicpc.net/problem/17140 17140번: 이차원 배열과 연산 첫째 줄에 r, c, k가 주어진다. (1 ≤ r, c, k ≤ 100) 둘째 줄부터 3개의 줄에 배열 A에 들어있는 수가 주어진다. 배열 A에 들어있는 수는 100보다 작거나 같은 자연수이다. www.acmicpc.net import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.util.*; public class P17140 { static int r, c, k; static int ans=-1; static Arr..
https://www.acmicpc.net/problem/1963 1963번: 소수 경로 소수를 유난히도 좋아하는 창영이는 게임 아이디 비밀번호를 4자리 ‘소수’로 정해놓았다. 어느 날 창영이는 친한 친구와 대화를 나누었는데: “이제 슬슬 비번 바꿀 때도 됐잖아” “응 지금 www.acmicpc.net import java.util.*; public class P1963 { static boolean[] prime=new boolean[10000]; static boolean[] visit; static int T; static String A, B; static Queue q; public static boolean isPrime(int N) { return !prime[N]; } public stat..
https://www.acmicpc.net/problem/2589 2589번: 보물섬 보물섬 지도를 발견한 후크 선장은 보물을 찾아나섰다. 보물섬 지도는 아래 그림과 같이 직사각형 모양이며 여러 칸으로 나뉘어져 있다. 각 칸은 육지(L)나 바다(W)로 표시되어 있다. 이 지도에서 www.acmicpc.net import java.util.*; public class P2589 { static int N, M; static int maxVal=0; static String[] board; static boolean[][] visited; static int[] dx={-1,1,0,0}; static int[] dy={0,0,-1,1}; public static void main(String[] args) ..