오늘은 참여한지 7일차 입니다.
22일 Basic 챌린지에 대한 상세한 내용은 아래 링크에서 확인할 수 있습니다.
https://developer-p.tistory.com/171
Day 7
220227 공부 일지 : 영어문제여도 당황하지 않고 풀 수 있도록 적응해야겠다.
백준 Swift 13297번
// MARK: - 13297번
//let N = Int(readLine()!)!
//
//for _ in 0..<N {
// let input = readLine()!.map{String($0)}
// print(input.count)
//}
백준 Swift 16316번
// MARK: - 16316번
let N = Int(readLine()!)!
var input = readLine()!.split(separator: " ").map{String($0)}
var answerArray: [String] = Array(repeating: "0", count: N)
var index: Int = 1
for i in 0..<N {
if input[i] == "mumble" {
input[i] = String(index)
}
answerArray[i] = String(index)
index += 1
}
if input == answerArray {
print("makes sense")
}
else {
print("something is fishy")
}
백준 Swift 16316번
// MARK: - 16316번
let N = Int(readLine()!)!
var input = readLine()!.split(separator: " ").map{String($0)}
var answerArray: [String] = Array(repeating: "0", count: N)
var index: Int = 1
for i in 0..<N {
if input[i] == "mumble" {
input[i] = String(index)
}
answerArray[i] = String(index)
index += 1
}
if input == answerArray {
print("makes sense")
}
else {
print("something is fishy")
}
백준 Swift 16408번
// MARK: - 16408번
let input = readLine()!.split(separator: " ").map{String($0)}
var countArray = Array(repeating: 0, count: 13)
let temp = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K"]
for ch in input {
// print(ch[ch.index(ch.startIndex, offsetBy: 1)])
let comparisonCh = ch.first! // 혹은 이렇게 ch[ch.index(ch.startIndex, offsetBy: 0)]
for (index, t) in temp.enumerated() {
if String(comparisonCh) == t {
countArray[index] += 1
}
}
}
print(countArray.max()!)
백준 Swift 21553번 - 런타임오류
// MARK: - 21553번
let A = Int(readLine()!)!
let P = Int(readLine()!)!
print(P) // B = P
백준 Swift 23343번
// MARK: - 23343번
let input = readLine()!.split(separator: " ").map{String($0)}
let (x, y) = (input[0], input[1])
var checkX: Bool = false
var checkY: Bool = false
if Int(x) != nil { // 숫자로 바꿀 수 있으면,
checkX = true
}
if Int(y) != nil { // 숫자로 바꿀 수 있으면,
checkY = true
}
if checkX == true && checkY == true { // 둘 다 숫자로 바꿀 수 있으면,
print(Int(x)! - Int(y)!)
}
else {
print("NaN")
}
백준 Swift 1008번
// MARK: - 1008번
let input = readLine()!.split(separator: " ").map{Double(String($0))!}
print(input[0] / input[1])
백준 Swift 9498번
// MARK: - 9498번
let score = Int(readLine()!)!
switch score {
case 90...100:
print("A")
case 80...89:
print("B")
case 70...79:
print("C")
case 60...69:
print("D")
default:
print("F")
}
백준 Swift 1330번
// MARK: - 1330번
let input = readLine()!.split(separator: " ").map{Int(String($0))!}
let (A, B) = (input[0], input[1])
if A > B {
print(">")
}
else if A < B {
print("<")
}
else {
print("==")
}
백준 Swift 2753번
// MARK: - 2753번
let year = Int(readLine()!)!
if (year % 4 == 0 && year % 100 != 0) || year % 400 == 0 {
print("1")
}
else {
print("0")
}
백준 Swift 14681번
// MARK: - 14681번
let x = Int(readLine()!)!
let y = Int(readLine()!)!
if x > 0 && y > 0 {
print("1")
}
else if x < 0 && y > 0 {
print("2")
}
else if x < 0 && y < 0 {
print("3")
}
else if x > 0 && y < 0 {
print("4")
}
백준 Swift 10797번(1)
// MARK: - 10797번(1)
let input = Int(readLine()!)!
let numArray = readLine()!.split(separator: " ").map{Int(String($0))!}
var count: Int = 0
for num in numArray {
if input == num {
count += 1
}
}
print(count)
백준 Swift 10797번(2)
// MARK: - 10797번(2)
let input = Int(readLine()!)!
let answer = readLine()!.split(separator: " ").filter{Int($0) == input}
print(answer.count)
백준 Swift 10162번
// MARK: - 10162번
let T = Int(readLine()!)!
var (countA, countB, countC) = (0, 0, 0)
if T % 10 != 0 {
print("-1")
}
else {
countA = T / 300
countB = (T % 300) / 60
countC = ((T % 300) % 60) / 10
print("\(countA) \(countB) \(countC)")
}
DAY7 인증완료
반응형
최근댓글