티스토리 뷰

반응형

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int tc = Integer.parseInt(br.readLine());

        for (int i = 0; i < tc; i++) {
            String[] command = br.readLine().split(" ");

            if (command[0].equals("add")) {
                int num = Integer.parseInt(command[1])-1;
                set.addNum(num);
            }
         }

 

 

 

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());

        StringTokenizer stA = new StringTokenizer(br.readLine());
        StringTokenizer stB = new StringTokenizer(br.readLine());
        br.close();

        int[] arrayA = new int[n];
        int[] arrayB = new int[n];

        for (int i = 0; i < n; i++) {
            arrayA[i] = Integer.parseInt(stA.nextToken());
            arrayB[i] = Integer.parseInt(stB.nextToken());
        }

    }
}

 

 

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


        int firstDigit = B.charAt(0) - '0';
        int secondDigit = B.charAt(1) - '0';
        int thirdDigit = B.charAt(2)-'0';


        System.out.println(A*thirdDigit);
        System.out.println(A*secondDigit);
        System.out.println(A*firstDigit);

        System.out.println(A*Integer.parseInt(B));

    }
}

 

 

 

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

        int[] inputNumArr = new int[3];

        for (int i = 0; i < inputNumArr.length; i++) {
            inputNumArr[i] = Integer.parseInt(st.nextToken());
        }

        ABC abc = new ABC(inputNumArr);
        abc.insertSort();

        String[] inputAlphabet = br.readLine().split("");

        for (int i = 0; i < 3; i++) {
            System.out.print(abc.printToMatchABC(i, inputAlphabet));
        }

    }
}

class ABC {   
    private int convertWordToNum(int i, String[] inputAlphabet) {
        return inputAlphabet[i].charAt(0) - 'A';
    }
}

*  A -> 1 : inputAlphabet[i].charAt(0) - 'A'

*  a -> 1 :  inputAlphabet[i].charAt(0) - 'a'

* '3'(문자) ->3(숫자) :  inputAlphabet[i].charAt(0) - '0'

 

 

 

 

Q. parseInt란?

Q. parseInt와 ValueOf의 차이는?

https://stackoverflow.com/questions/508665/different-between-parseint-and-valueof-in-java

반응형

'Algorithms' 카테고리의 다른 글

[Algorithm] 백준 16933의 메모리 초과  (0) 2024.02.23
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
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
글 보관함