준코딩

[Swift] 백준 11021번 문제 A+B - 7 본문

알고리즘/Swift 백준 문제풀이

[Swift] 백준 11021번 문제 A+B - 7

Ljunhyeob - App Dev 2023. 1. 5. 14:08

https://www.acmicpc.net/problem/11021

 

11021번: A+B - 7

각 테스트 케이스마다 "Case #x: "를 출력한 다음, A+B를 출력한다. 테스트 케이스 번호는 1부터 시작한다.

www.acmicpc.net

 

https://github.com/Ljunhyeob/baekjoon11021

 

GitHub - Ljunhyeob/baekjoon11021: 백준 - 11021

백준 - 11021. Contribute to Ljunhyeob/baekjoon11021 development by creating an account on GitHub.

github.com

//
//  main.swift
//  baekjoon11021
//
//  Created by 이준협 on 2023/01/04.
//
import Foundation

let num = readLine()!
var numInt = Int(num)!
var totalArr : [Int] = []

for i in 0..<numInt{
    let line = readLine()!
    let lineArr = line.components(separatedBy: " ")
    let a = Int(lineArr[0])!
    let b = Int(lineArr[1])!
    totalArr.append(a+b)
}

for i in 0..<numInt{
    print("Case #\(i+1): \(totalArr[i])")
}
Comments