문제 출처: https://www.acmicpc.net/problem/2750




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
 
public class Main {
    
    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(reader.readLine());
        int[] arr = new int[N];
        
        for(int i=; i<N ; i++)
            arr[i] = Integer.parseInt(reader.readLine());
        
        Arrays.sort(arr);
        
        StringBuilder builder = new StringBuilder();
        for(int i=; i<N ; i++)
            builder.append(arr[i]).append("\n");
        
        System.out.println(builder);
    }
}
cs



'Algorithm' 카테고리의 다른 글

백준 10989번: 수 정렬하기 3  (0) 2018.10.20
백준 2751번: 수 정렬하기 2  (0) 2018.10.20
백준 2941번: 크로아티아 알파벳  (0) 2018.10.20
백준 5622번: 다이얼  (0) 2018.10.20
백준 2908번: 상수  (0) 2018.10.20

문제출처: https://www.acmicpc.net/problem/2941




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
 
public class Main {
    private static String input = "";
    private static int count = 0;
    private static ArrayList<String> list = new ArrayList<>();
    
    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        input = reader.readLine();
        list.add("c="); list.add("c-"); list.add("dz="); list.add("d-");
        list.add("lj"); list.add("nj"); list.add("s="); list.add("z=");
        
        for(int i=; i<input.length() ; i++){
            if (input.length() >= i+&& isContain(i, i+3)) {
                i = i+2;
                continue;
            }
            if (input.length() >= i+&& isContain(i, i+2)) {
                i = i+1;
                continue;
            }
            count++;
        }
        
        System.out.println(count);
    }
    
    public static boolean isContain(int start, int end){
        String word = input.substring(start, end);
        
        if(list.contains(word)){
            count++;
            return true;
        }
        else{
            return false;
        }
    }
}
cs


'Algorithm' 카테고리의 다른 글

백준 2751번: 수 정렬하기 2  (0) 2018.10.20
백준 2750번: 수 정렬하기  (0) 2018.10.20
백준 5622번: 다이얼  (0) 2018.10.20
백준 2908번: 상수  (0) 2018.10.20
백준 1316번: 그룹 단어 체커  (0) 2018.10.20

문제출처: https://www.acmicpc.net/problem/5622




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import java.io.BufferedReader;
import java.io.InputStreamReader;
 
public class Main {
    
    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String input = reader.readLine();
        // 2:ABC, 3:DEF, 4:GHI, 5:JKL, 6:MNO, 7:PQRS, 8:TUV, 9:WXYZ (1초씩 더 걸림)
        int[] arr = {333444555666777888899910101010};
        int result = 0;
        
        for(int i=; i<input.length() ; i++)
            result += arr[input.charAt(i)-'A'];
        
        System.out.println(result);
    }
}
cs



'Algorithm' 카테고리의 다른 글

백준 2750번: 수 정렬하기  (0) 2018.10.20
백준 2941번: 크로아티아 알파벳  (0) 2018.10.20
백준 2908번: 상수  (0) 2018.10.20
백준 1316번: 그룹 단어 체커  (0) 2018.10.20
백준 1157번: 단어 공부  (0) 2018.10.20

+ Recent posts