less than 1 minute read

개요

두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.

입력

첫째 줄에 A와 B가 주어진다. (0 < A, B < 10)

출력

첫째 줄에 A+B를 출력한다.

예제 입력 1

1 2

예제 출력 1

3

내 풀이

C

메모리 시간 코드 길이
1112KB 0ms 186B
#include <stdio.h>


int main(void) {
    int A, B;
    scanf("%d %d", &A, &B);
    printf("%d", A + B);

    return 0;
}

Python

메모리 시간 코드 길이
30840KB 72ms 46B
a, b = map(int, input().split())
print(a + b)

Node.js

메모리 시간 코드 길이
9460KB 144ms 328B
const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let input = [];

rl.on('line', function (line) {
    input = line.split(' ').map((el) => parseInt(el));
}).on('close', function () {
    console.log(input[0] + input[1]);
    process.exit();
});

출처


Back to top ↑

Leave a comment