baekjoon 20260203
This commit is contained in:
parent
6a49b56c53
commit
3f90e25b13
15
code_study/Baekjoon/swift/2506.swift
Normal file
15
code_study/Baekjoon/swift/2506.swift
Normal file
@ -0,0 +1,15 @@
|
||||
let N = Int(readLine()!)
|
||||
var nums = (readLine()!).split(separator: " ").compactMap{Int($0)}
|
||||
|
||||
var score = 0
|
||||
var ans = 0
|
||||
for n in nums {
|
||||
if n==0 {
|
||||
score = 0
|
||||
continue
|
||||
}
|
||||
score += 1
|
||||
ans += score
|
||||
}
|
||||
|
||||
print(ans)
|
||||
Loading…
x
Reference in New Issue
Block a user