inblog logo
|
silver
    알고리즘문제풀기

    [알고리즘문제풀기] 덧셈식 출력하기

    silver's avatar
    silver
    May 26, 2025
    [알고리즘문제풀기] 덧셈식 출력하기
    Contents
    문제내가 작성한 정답다른 사람들의 정답

    문제

    school.programmers.co.kr
    https://school.programmers.co.kr/learn/courses/30/lessons/181947?language=java

    내가 작성한 정답

    Java

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); System.out.println(a +" + "+ b +" = "+ (a+b) ); } }

    JavaScript

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); System.out.println(a +" + "+ b +" = "+ (a+b) ); } }

    다른 사람들의 정답

    JavaScript

    const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); let a, b; rl.on('line', function (line) { [a, b] = line.split(' ').map(Number); }).on('close', function () { console.log(`${a} + ${b} = ${a + b}`); });
    Share article

    silver

    RSS·Powered by Inblog