-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
19-wkdghdwns199 #76
19-wkdghdwns199 #76
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ λ κ±°μ λκ°μ΄ νμλ€μ
fun main() {
val br = BufferedReader(InputStreamReader(System.`in`))
val n = br.readLine().toInt()
var set = mutableSetOf<String>()
var answer = 0
for (i in 0 until n) {
val input = br.readLine()
if (input == "ENTER") {
answer += set.size
set = mutableSetOf()
continue
}
set.add(input)
}
answer += set.size
println(answer)
}
for _ in range(N): | ||
chat_string = input().rstrip() | ||
if chat_string == 'ENTER' : | ||
if time_for_emoji_use : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ΄κ±΄ μ΄λ€ κ²μ μλ―Ένλ 건κ°μ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ΄κ±° μ±ν κΈ°λ‘μ ν μ€ μ© λ°μμ λ§μ½ ENTER μ΄λ©΄ μ΄μ λΆν° λ°μ μλ μ±ν κΈ°λ‘μ μ λΆ κ³°κ³°μ΄ μ΄λͺ¨ν°μ½μ μ°λ μ¬λλ€μ΄λ€! λΌκ³ 체ν¬νλ κ²λλ€μ π₯Ή
μ λ° μ μμ μΈ λ¬Έμ λ₯Ό νμ΄μ£ΌμΈμ |
setμ clear()ν¨μλ‘ μ΄λ κ² κ°λ¨ν μ½λλ‘ κ°λ₯ν κ² κ°λ€μ!! n = int(input())
gom = set()
result = 0
for i in range(n):
word = input()
if word != "ENTER":
if word not in gom:
result += 1
gom.add(word)
else:
gom.clear()
print(result) |
κ·Έλ¦¬κ³ κ°μΈμ μΌλ‘ λ¬Έμ λ₯Ό νλ λ³μκ° λ무 κΈΈκ³ μ΄λ €μ°λ©΄ μ λ μλμμ±μ λ§μ΄ μ°μ§λ μμμ 볡μ¬νκ±°λ μΉ λκ° λ§μμ κ°λ¨νκ² μ΄ν΄λ λκ² νλ νΈμΈλ° μλ λ³μλͺ μ κ·Έλ κ² μ§μΌμλ건κ°μ!?
|
emoji_use_count += len(emoji_using_users) | ||
else : | ||
time_for_emoji_use = True | ||
emoji_using_users = set() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μλ‘ μ μΈνλκ²λ μ’μ§λ§ emoji_using_users.clear() λ°©λ²λ μμ κ² κ°μμ!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ λ κ°λ¨νκ² setμ μ΄μ©ν΄μ ꡬνν΄λ΄€μ΅λλ€!
import sys
input = sys.stdin.readline
N = int(input())
counter = "ENTER"
is_gom = set()
cnt = 0
for _ in range(N):
_new = input().rstrip()
if _new == counter:
is_gom.clear()
continue
if _new not in is_gom:
cnt += 1
is_gom.add(_new)
print(cnt)
λ€ μ΄κ² λ»μ λ£μ΄μ λ³μλͺ μ λ κ±Έ μ’μν΄μ κ·Έλ κ² νλλ°, μ½ν μΉ λλ μ’ μ μ’μκΉμ? |
π λ¬Έμ λ§ν¬
μΈμ¬μ± λ°μ κ³°κ³°μ΄
https://www.acmicpc.net/problem/25192
βοΈ μμλ μκ°
30λΆ - set ν¨μ μ€λ³΅ μ κ±°μ νμνλ€μ!
β¨ μλ μ½λ
ENTER λ¬Έμμ΄μ΄ λ€μ΄μ€λ μμ μμ λ€μ μ λ ₯λλ μ¬μ©μ λ¬Έμμ΄λ€μ μλ₯Ό μΈμ λν΄μ£Όλ©΄ λ©λλ€! νμ§λ§ μ¬κΈ°μ 쑰건 νλ!
μ΄λ₯Ό 보면 ν λ² μΉ΄μ΄νΈ λ μ¬μ©μλ λ€μ μΉ΄μ΄νΈ λλ©΄ μλλ€λ λ§μ΄λ€. μ¦, μ€λ³΅μ΄ λλ©΄ μλλ€λ λ§μ λλ€.
μ§κΈκΉμ§ μ€λ³΅ μ κ±°μ λν΄ μ½μ§νλ€ κ²°κ΅ μ²΄λν set() ν¨μλ₯Ό λ°λ‘ λ μ¬λ €μ ENTER κ° λ€μ΄μ¨ νλ νμ setμ μ¬μ©μ μ΄λ¦ λ¬Έμμ΄μ μ§μ΄λ£μ΄μ μ€λ³΅ μ κ±°λ₯Ό νμμ΅λλ€. κ·Έλ¦¬κ³ λ€λ₯Έ ENTER κ° λ€μ΄μ¬ λ λ§λ€ set μ μ΄κΈ°ννμ¬ λ€μ μ΄λͺ¨ν°μ½μ μ°λ μ¬μ©μλ€μ μΉ΄μ΄νΈ ν΄μ€λλ€.
μ½λ μμ
π μλ‘κ² μκ²λ λ΄μ©
μ΄μ λΆν°λ νκ· λμ΄ λΉλ €μ£Όμλ μκ³ λ¦¬μ¦ μ± λ³΄κ³ κ³΅λΆν΄λ΄μΌκ² λ€! (λ°±μ€ μ μ μλ ..!)