QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#715478 | #9578. 爱上字典 | zxk | RE | 175ms | 74040kb | Python3 | 633b | 2024-11-06 12:14:56 | 2024-11-06 12:14:56 |
Judging History
answer
import sys
# 读取整个输入内容
input_data = sys.stdin.read().strip().splitlines()
# 提取文本和单词表
text = input_data[0]
n = int(input_data[1])
known_words = set(input_data[2].split())
# 处理小说文本,将所有单词转换为小写并去掉标点符号
unique_words = set()
for word in text.split():
if word[-1] in ['.', '?', '!', ',']:
unique_words.add(word[:-1].lower())
else:
unique_words.add(word.lower())
# 将已知单词从集合中移除
for word in known_words:
unique_words.discard(word)
# 输出剩余的单词数量
print(len(unique_words))
详细
Test #1:
score: 100
Accepted
time: 6ms
memory: 10616kb
input:
I love Liaoning. Love Dalian! 1 love
output:
3
result:
ok single line: '3'
Test #2:
score: 0
Accepted
time: 7ms
memory: 10580kb
input:
Sulfox Loves Furry! Fur fur Furred. 2 anthropomorphic furry
output:
4
result:
ok single line: '4'
Test #3:
score: 0
Accepted
time: 14ms
memory: 10700kb
input:
Ginkgo leaves dance lightly and fall, reflecting the autumn light on the golden ground. Time is as peaceful as when we first met. 5 ginkgo reflect is as we
output:
17
result:
ok single line: '17'
Test #4:
score: 0
Accepted
time: 145ms
memory: 74040kb
input:
Eunuchism overterrible furbelow gantlet. Sophism thyroiditis thermoelectricity hassel misreward Barolong biradiated? Sweetie fatal delinquence unseemlily beamish inwork, azyme kamias Hans asteatosis synderesis champleve cheth? Dinitrile podial presentee! Waxmaker scleroscope ratably hectography lamp...
output:
201961
result:
ok single line: '201961'
Test #5:
score: 0
Accepted
time: 175ms
memory: 73964kb
input:
Unsubsidiary unsacrificeable hacking colberter pseudoappendicitis rufescence tumbak? Hypocrize aithochroi. Spina machar proximation? Chaperone vermicide virescent Klan preplacental unabsolvedness Sarcosporida noveletter waspishness sponge trustle bistetrazole prepositure melamed, cinephone. Physopho...
output:
201951
result:
ok single line: '201951'
Test #6:
score: 0
Accepted
time: 156ms
memory: 73912kb
input:
Baikerite discontentful semicitizen Acoemetic veracity pretechnical bloodweed cytogenetic icebound disrelishable leader meltedness heroship sciniph gunsel fatalistically unreasoned anticatarrhal? Unmentioned! Overaddiction broomy misapplication hecte inflammable disheart dicaryon blacktail prisonabl...
output:
201759
result:
ok single line: '201759'
Test #7:
score: -100
Dangerous Syscalls
input:
Dizoic filtering damenization bistipuled Opisthothelae multiangular blaff mortally. Perfusive alkaptonuria possessorial coinstantaneousness Stanhopea Nascan. Ankylostoma aumil oxygenicity cubhood abandonee fishman poppy pickpole synkinesis arteriosclerosis coloproctitis prematrimonial pseudoviaduct ...