0
0

More than 1 year has passed since last update.

Posted at

# 正解済み問題

## A - Alternately

こちら問題ページ

``````let n = Int(readLine()!)!

var isCorrect = true
var preS = s[0]
for index in 1..<n {
if preS == s[index] {
isCorrect = false
break
}
preS = s[index]
}

print(isCorrect ? "Yes" : "No")
``````

## B - Chessboard

こちら問題ページ

``````let positonMark = [["a","b","c","d","e","f","g","h"],["8","7","6","5","4","3","2","1"]]
var field = [[String]]()

for _ in 0..<8 {
}

var position = ""

for row in 0..<field.count {
for column in 0..<field[row].count {
if field[row][column] == "*" {
position = positonMark[0][column] + positonMark[1][row]
break
}
}
}

print(position)
``````

# 誤答及び、未解答問題

## C - Gap Existence

こちら問題ページ

``````let nx = readLine()!.split(separator: " ").map{Int(\$0)!}
let a = readLine()!.split(separator: " ").map{Int(\$0)!}
var values: Set<Int> = []
var ans = false
for aij in a {
let comp1 = nx[1] + aij
let comp2 = -(nx[1] - aij)
values.insert(aij)
if values.contains(comp1) || values.contains(comp2) {
ans = true
break
}
}
print(ans ? "Yes" : "No")
``````

# 参考

0
0
0

Register as a new user and use Qiita more conveniently

1. You get articles that match your needs
2. You can efficiently read back useful information
3. You can use dark theme
What you can do with signing up
0
0