• 欢迎访问废江's博客 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏本站吧

Dictionary

AOJ 站点默认 10个月前 (04-09) 435次浏览 已收录 39个评论
文章目录[隐藏]

Question

Your task is to write a program of a simple dictionary which implements the following instructions:

insert str: insert a string str in to the dictionary
find str: if the distionary contains str, then print ‘yes’, otherwise print ‘no’
Input
In the first line n, the number of instructions is given. In the following n lines, n instructions are given in the above mentioned format.

Output
Print yes or no for each find instruction in a line.

Constraints
A string consists of ‘A’, ‘C’, ‘G’, or ‘T’
1 ≤ length of a string ≤ 12
n ≤ 1000000
Sample Input 1
5
insert A
insert T
insert C
find G
find A
Sample Output 1
no
yes
Sample Input 2
13
insert AAA
insert AAC
insert AGA
insert AGG
insert TTT
find AAA
find CCC
find CCC
insert CCC
find CCC
insert T
find TTT
find T
Sample Output 2
yes
no
no
yes
yes
yes

Meaning


写一个简易字典,输入中给字典插入字符串,然后有查找,如果找到便输出yes,找不到输出no

Solution

没看书本上的解题,第一步想的就是STL里面的vector+find函数,虽然猜到会超时,但先走一遍。

Coding

Summary

果然没有ac全,只过了九个测试点,这题的话思考一下可以考虑使用散列查找。

个人博客 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:Dictionary
喜欢 (1)
[]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到
(39)个小伙伴在吐槽
  1. This web site is my intake, very fantastic pattern and Perfect content. Joline Osbourne Yamauchi
    bahis2021-01-22 07:24 (3小时前)回复 Windows 10 | Chrome 86.0.4240.193
  2. Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me. Anyways, I’m definitely happy I found it and I’ll be book-marking and checking back frequently!
    leandra battiest2020-12-27 08:19 回复 Windows 7 | Firefox浏览器 4.0
  3. You made some nice points there. I looked on the internet for the subject matter and found most individuals will agree with your site.
    werner gwartney2020-12-26 05:33 回复 Windows 7 | Firefox浏览器 4.0
  4. Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me. Anyways, I’m definitely happy I found it and I’ll be book-marking and checking back frequently!
    teisha breutzmann2020-12-25 00:09 回复 Windows 7 | Firefox浏览器 4.0
  5. Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me. Anyways, I’m definitely happy I found it and I’ll be book-marking and checking back frequently!
    belen leverone2020-12-24 11:29 回复 Windows 7 | Firefox浏览器 4.0
  6. Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me. Anyways, I’m definitely happy I found it and I’ll be book-marking and checking back frequently!
    walter compres2020-12-24 09:34 回复 Windows 7 | Firefox浏览器 4.0
  7. You made some nice points there. I looked on the internet for the subject matter and found most individuals will agree with your site.
    karina schoenstein2020-12-24 07:15 回复 Windows 7 | Firefox浏览器 4.0
  8. You are a great story teller. Thank you for telling us about your childhood memories and the glory days of boxing. Mildrid Cletus Galven
    ucretsiz2020-12-23 11:35 回复 Windows 10 | Chrome 86.0.4240.193
  9. Yes! Finally something about best water softeners. Marrilee Noah Fitzger
    torrent2020-12-22 19:27 回复 Windows 10 | Chrome 86.0.4240.193
  10. You got a very wonderful website, Glad I detected it through yahoo. Minny Ange Druce
    yify2020-12-22 04:47 回复 Windows 10 | Chrome 86.0.4240.193
  11. I am so grateful for your blog post. Really thank you! Keep writing. Dena Bruce Maller
    web-dl2020-12-21 13:01 回复 Windows 10 | Chrome 86.0.4240.193
  12. You need to take part in a contest for one of the greatest websites online. Karel Micky Cavanaugh
    download2020-12-21 06:08 回复 Windows 10 | Chrome 86.0.4240.193
  13. Wonderful post! We are linking to this great article on our site. Keep up the good writing. Tilda Bent Normand
    download2020-12-21 04:44 回复 Windows 10 | Chrome 86.0.4240.193
  14. I always was interested in this topic and still am, regards for putting up. Danielle Warde Florian
    web-dl2020-12-21 02:59 回复 Windows 10 | Chrome 86.0.4240.193
  15. Everything is very open with a very clear explanation of the challenges. It was truly informative. Your site is very useful. Thank you for sharing. Arabela Rodrick Pablo
    ucretsiz2020-12-21 02:29 回复 Windows 10 | Chrome 86.0.4240.193
  16. You completed various nice points there. I did a search on the topic and found most people will consent with your blog. Miran Hodge Marcia
    yify2020-12-20 23:33 回复 Windows 10 | Chrome 86.0.4240.193
  17. Hi there very nice site!! Guy .. Excellent .. Wonderful .. Barby Jecho Litt
    web-dl2020-12-20 22:01 回复 Windows 10 | Chrome 86.0.4240.193
  18. Its fantastic as your other posts : D, regards for putting up. Susana Ian Runkel
    torrent2020-12-20 17:35 回复 Windows 10 | Chrome 86.0.4240.193
  19. You made some decent factors there. I searched the internet for the issue as well as located most individuals will support with your web site. Isobel Ethe Bazil
    ucretsiz2020-12-20 16:27 回复 Windows 10 | Chrome 86.0.4240.193
  20. Great message for all the people. And also very interesting facts about the plastic surgery. Roxie Maxim Rheba
    ucretsiz2020-12-20 14:13 回复 Windows 10 | Chrome 86.0.4240.193
  21. AD List 24 provides local classified ads for events, jobs, rentals, real estate, buy and sell, adults and dating. Page Padraic Reine
    sikis2020-12-20 00:37 回复 Windows 10 | Chrome 86.0.4240.193
  22. I am going to share this post with my friends. amazing. Roseanne Kelbee Tychonn
    sikis2020-12-19 22:56 回复 Windows 10 | Chrome 86.0.4240.193
  23. Thanks for sharing, this is a fantastic post. Cool. Tamarra Riccardo Drusie
    sikis2020-12-19 21:02 回复 Windows 10 | Chrome 86.0.4240.193
  24. Rattling wonderful info can be found on web blog . "You don't get harmony when everybody sings the same note." by Doug Floyd. Kim Harman Kunz
    sikis2020-12-19 19:47 回复 Windows 10 | Chrome 86.0.4240.193
  25. I really liked your blog article. Much thanks again. Really Cool. Lindie Hy Rauch
    erotik2020-12-19 17:45 回复 Windows 10 | Chrome 86.0.4240.193
  26. Thank you for your post. Really thank you! Fantastic. Zola Willi Ingold
    bahis2020-12-19 16:21 回复 Windows 10 | Chrome 86.0.4240.193
  27. Major thankies for the article. Much thanks again. Great. Katya Boniface Zulema
    sikis2020-12-19 12:46 回复 Windows 10 | Chrome 86.0.4240.193
  28. Hi there colleagues, its fantastic piece of writing about tutoringand fully defined, keep it up all the time. Helen Bax Coster
    sikis2020-12-19 01:17 回复 Windows 10 | Chrome 86.0.4240.193
  29. Enjoyed reading through this, very good stuff, appreciate it. Adrianne Darren Abbotson
    erotik2020-12-18 23:07 回复 Windows 10 | Chrome 86.0.4240.193
  30. Will not need any technical skills or massive researching firepower. Caprice Wood Montfort
    erotik2020-12-18 21:54 回复 Windows 10 | Chrome 86.0.4240.193
  31. In order to become a good soccer player, you need to learn how to dribble. Marjorie Alphonso Virgy
    sikis2020-12-18 20:09 回复 Windows 10 | Chrome 86.0.4240.193
  32. Great delivery. Great arguments. Keep up the great spirit. Katherina Brade Uno
    erotik2020-12-18 17:46 回复 Windows 10 | Chrome 86.0.4240.193
  33. Now I am going away to do my breakfast, once having my breakfast coming over again to read further news. Ula Micky Lowrie
    sikis2020-12-18 15:59 回复 Windows 10 | Chrome 86.0.4240.193
  34. I truly appreciate this article post. Much obliged. Conni Thomas Asquith
    erotik2020-12-18 12:21 回复 Windows 10 | Chrome 86.0.4240.193
  35. Asking questions are really good thing if you are not understanding anything fully, however this piece of writing offers good understanding even. Vivianne Tore Bensky
    erotik2020-12-18 05:35 回复 Windows 10 | Chrome 86.0.4240.193
  36. Thanks a lot for the article post. Much thanks again. Fantastic. Rubina Kerk Sedgewinn
    bahis2020-12-17 16:23 回复 Windows 10 | Chrome 86.0.4240.193
  37. Thanks for sharing, this is a fantastic post. Really looking forward to read more. Great. Blanca Hanan Tildie
    porno2020-12-15 04:41 回复 Windows 10 | Chrome 86.0.4240.193
  38. You made a number of fine points there. I did a search on the topic and found the majority of persons will have the same opinion with your blog. Lenee Lamar Marlyn
    film modu2020-12-11 00:17 回复 Windows 10 | Chrome 86.0.4240.193
  39. looks nice but it’s huge.
    匿名2020-11-21 22:29 回复 Windows 10 | Chrome 62.0.3202.94