QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#715466#9578. 爱上字典NULL_SFAC ✓366ms85476kbC++231.6kb2024-11-06 12:13:032024-11-06 12:13:04

Judging History

你现在查看的是最新测评结果

  • [2024-11-06 12:13:04]
  • 评测
  • 测评结果:AC
  • 用时:366ms
  • 内存:85476kb
  • [2024-11-06 12:13:03]
  • 提交

answer

#include <iostream>
#include <set>
#include <sstream>
#include <cctype>
#include <string>
#include <vector>

using namespace std;

int main() {
    // 输入第一行,split成单词列表
    string input_line;
    getline(cin, input_line);
    stringstream ss(input_line);
    vector<string> word_list;
    string word;
    
    while (ss >> word) {
        word_list.push_back(word);
    }

    // 用于存储单词的小写形式
    set<string> s;

    // 处理每个单词
    for (const string &word : word_list) {
        string processed_word = word;
        // 如果单词的最后一个字符是标点符号,去掉它
        if (processed_word.back() == '.' || processed_word.back() == '?' || processed_word.back() == '!' || processed_word.back() == ',') {
            processed_word.pop_back();
        }
        
        // 转换成小写
        for (char &c : processed_word) {
            c = tolower(c);
        }

        // 添加到集合
        s.insert(processed_word);
    }

    // 输入第二行,字典中的单词
    int n;
    cin >> n;
    cin.ignore(); // 清除换行符
    getline(cin, input_line);
    stringstream ss2(input_line);
    vector<string> dict_list;
    
    while (ss2 >> word) {
        dict_list.push_back(word);
    }

    // 从集合中去除字典中的单词
    for (const string &word : dict_list) {
        string lower_word = word;
        for (char &c : lower_word) {
            c = tolower(c);
        }
        s.erase(lower_word);
    }

    // 输出剩余单词的数量
    cout << s.size() << endl;

    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3848kb

input:

I love Liaoning. Love Dalian!
1
love

output:

3

result:

ok single line: '3'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3844kb

input:

Sulfox Loves Furry! Fur fur Furred.
2
anthropomorphic furry

output:

4

result:

ok single line: '4'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3548kb

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: 357ms
memory: 46204kb

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: 311ms
memory: 46372kb

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: 341ms
memory: 46256kb

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: 0
Accepted
time: 308ms
memory: 46628kb

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 ...

output:

202281

result:

ok single line: '202281'

Test #8:

score: 0
Accepted
time: 366ms
memory: 52216kb

input:

Thelorrhagia me Camaldulian Menfra me drugman pneumonolithiasis, fructose me inwit caubeen manchet! Enjeopardy me quindecennial me unrecompensable creaturize undiverting bitty dama interteam curfew excedent me me. Revealingness Nipponism opticity suwe me stilty me antiquarism Iacchic me contrapuntal...

output:

195780

result:

ok single line: '195780'

Test #9:

score: 0
Accepted
time: 141ms
memory: 85476kb

input:

Me me me me me me me me me me me me me me me. Me me. Me. Me me me me? Me me me me me me me me, me me! Me me. Me me me me me me me me me! Me me? Me me, me? Me me me me me me me me me, me me me me me? Me, me me me me me me me me me me me me me me me me? Me me me. Me me me me me, me me me me me me me! ...

output:

0

result:

ok single line: '0'

Test #10:

score: 0
Accepted
time: 139ms
memory: 84996kb

input:

Me me? Me me me me me me me me me me me, me me me. Me me me me me me me me me me me me me. Me, me me me me me me me me. Me me me me me me me me me me. Me me me me me me me me me me me me me! Me! Me me me! Me me me me me! Me me me me me me me me me me me! Me me me me me me? Me me me me me me. Me me m...

output:

0

result:

ok single line: '0'

Test #11:

score: 0
Accepted
time: 316ms
memory: 51056kb

input:

Subsemitone me pauperdom me amphopeptone me Keplerian isopolity premaniacal logia, unseducible gulper heterostylism contumeliously prevenience, clientry theurgically supportive. Me gossipiness lately electrooptic. Me. Me, boding, putrefacient unendowing hypercryalgesia me me pluviographic Elohist me...

output:

195507

result:

ok single line: '195507'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

I am a cat and an ant? An ape! And Imp. And imp Is I.
3
an industrialization is

output:

8

result:

ok single line: '8'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

Okay.
0

output:

1

result:

ok single line: '1'

Extra Test:

score: 0
Extra Test Passed