Post

[BaekJoon] 27327번 - 時間 (Hour) [Java][C++]

[BaekJoon] 27327번 - 時間 (Hour) [Java][C++]

문제 링크


1. 문제 풀이


하루는 $24$ 시간이므로, $X$ 일은 $24 \times X$ 시간이다.


2. 코드


1. 풀이 [Java]

1
2
3
4
5
6
7
8
9
10
import java.io.*;

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

        int X = Integer.parseInt(br.readLine());
        System.out.println(X * 24);
    }
}


2. 풀이 [C++]

1
2
3
4
5
6
7
8
9
10
11
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int x;
    cin >> x;
    cout << x * 24;
}

This post is licensed under CC BY 4.0 by the author.