[Rust로 백준 하루 하나] 1-11. 꼬마 정민

김진산·2024년 7월 23일

Rust로 백준 하루 하나

목록 보기
11/138
post-thumbnail

문제 (11382번)

꼬마 정민이는 이제 A + B 정도는 쉽게 계산할 수 있다. 이제 A + B + C를 계산할 차례이다!

입력

첫 번째 줄에 A, B, C (1 ≤ A, B, C ≤ 1012)이 공백을 사이에 두고 주어진다.

출력

A+B+C의 값을 출력한다.


풀이

코드

use std::io;

fn main() {
    let mut input = String::new();
    
    io::stdin()
        .read_line(&mut input)
        .expect("Cannot read line");
        
    let input: Vec<&str> = input.split_whitespace().collect();
    
    let a: u128 = input[0].trim().parse().unwrap();
    let b: u128 = input[1].trim().parse().unwrap();
    let c: u128 = input[2].trim().parse().unwrap();
    
    println!("{}", a+b+c);
}

해설


추가 학습

  • 특이사항 없음
profile
블록체인 개발자

0개의 댓글