POJ 1119 Start Up the Startup
来源:互联网 发布:vb编写九九乘法表 编辑:程序博客网 时间:2024/05/16 03:05
Start Up the Startup
Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1366 Accepted: 346
Description
Clearly the economy is bound to pick up again soon. As a forward-thinking Internet entrepreneur, you think that the 'Net will need a new search engine to serve all the people buying new computers. Because you're frustrated with the poor results most search engines produce, your search engine will be better.
You've come up with what you believe is an innovative approach to document matching. By giving weight to the number of times a term appears in both the search string and in the document being checked, you believe you can produce a more accurate search result.
Your program will be given a search string, followed by a set of documents. You will calculate the score for each document and print it to output in the order the document appears in the input. To calculate the score for a document you must first calculate the term score for each term appearing in the search string. A term score is the number of times a term occurs in the search string multiplied by the number of times it occurs in the document. The document score is the sum of the square roots of each term score.
You've come up with what you believe is an innovative approach to document matching. By giving weight to the number of times a term appears in both the search string and in the document being checked, you believe you can produce a more accurate search result.
Your program will be given a search string, followed by a set of documents. You will calculate the score for each document and print it to output in the order the document appears in the input. To calculate the score for a document you must first calculate the term score for each term appearing in the search string. A term score is the number of times a term occurs in the search string multiplied by the number of times it occurs in the document. The document score is the sum of the square roots of each term score.
Input
The input consists of a set of documents separated by single lines containing only ten dashes, "---------" No line will be longer than 250 characters. No document will be longer than 100 lines. The first document is the search string. The input terminates with two lines of ten dashes in a row.
The input documents will use the full ASCII character set. You must parse each document into a set of terms.
Terms are separated by whitespace in the input document. Comparisons between terms are case-insensitive. Punctuation is removed from terms prior to comparisons, e.g. "don't" becomes "dont" The resulting terms should contain only the characters {[a-z],[0-9]}. A term in the input consisting only of punctuation should be ignored. You may assume the search string and each document will have at least one valid term.
The input documents will use the full ASCII character set. You must parse each document into a set of terms.
Terms are separated by whitespace in the input document. Comparisons between terms are case-insensitive. Punctuation is removed from terms prior to comparisons, e.g. "don't" becomes "dont" The resulting terms should contain only the characters {[a-z],[0-9]}. A term in the input consisting only of punctuation should be ignored. You may assume the search string and each document will have at least one valid term.
Output
The output is a series of scores, one per line, printed to two decimal places. The scores are printed in the order the documents occur in the input. No other characters may appear in the output.
Sample Input
fee fi fo fum ---------- fee, fi, fo! fum!! ---------- fee fee fi, me me me ---------- ----------
Sample Output
4.002.41
Source
Mid-Atlantic 2001
- POJ 1119 Start Up the Startup
- POJ 1119 Start Up the Startup 已被翻译
- Poj 1583 Choose Your Words Carefully + Poj 1119 Start Up the Startup (字符串 map)
- zoj 1050 Start Up the Startup
- ZOJ 1050 start up the startup
- Start up the Velocity Template Engine
- Start-up...
- start up..........
- Start up
- start up
- Start-Up
- START UP
- The WebLogic Server did not start up properly.
- Ubuntu 12.04 X64,The AVD cannot start up by eclipse
- Error:'Please set up the forwarding function parameter "wipnp" in the workstation startup function!'
- The start—— POJ 1011 Sticks
- Tomcat7.0 start Could not find the main class: org.apache.catalina.startup.Bootstrap.
- CUDA easy start up
- 求最大流的使用距离标号的最短增广路算法
- jdk1.5新特性
- 去除浮躁 静一些 再静一些
- 求最大流的Relabel-to-Front算法
- 求最大权二分匹配的KM算法
- POJ 1119 Start Up the Startup
- 最小树形图
- 字符串匹配自动机
- 关于Hibernate的merge() attachDirty() attachClean()三种方法比较使用
- sqlite3.6.17 arm linux交叉编译 一个错误
- 为什么C++?
- 读后感:我们仍然在路上-走出软件作坊(五十)
- 获取某点的RGB三分量的值
- office2007中公式编辑器