| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 489 人关注过本帖
标题:在网上找到的一个题
只看楼主 加入收藏
zhaoyg
Rank: 1
等 级:新手上路
帖 子:328
专家分:0
注 册:2006-8-28
收藏
 问题点数:0 回复次数:4 
在网上找到的一个题

一下是在网上找到的一个题,据说是TopCoder的

Problem Statement
????
***Note: Please keep programs under 7000 characters in length. Thank you


Class Name: HowEasy
Method Name: pointVal
Parameters: String
Returns: int

TopCoder has decided to automate the process of assigning problem difficulty
levels to problems. TopCoder developers have concluded that problem difficulty
is related only to the Average Word Length of Words in the problem statement:

If the Average Word Length is less than or equal to 3, the problem is a 250
point problem.
If the Average Word Length is equal to 4 or 5, the problem is a 500 point
problem.
If the Average Word Length is greater than or equal to 6, the problem is a 1000
point problem.

Definitions:
Token - a set of characters bound on either side by spaces, the beginning of
the input String parameter or the end of the input String parameter.
Word - a Token that contains only letters (a-z or A-Z) and may end with a
single period. A Word must have at least one letter.
Word Length - the number of letters in a Word. (NOTE: a period is NOT a letter)

The following are Words :
"ab", "ab."

The following are not Words :
"ab..", "a.b", ".ab", "a.b.", "a2b.", "."

Average Word Length - the sum of the Word Lengths of every Word in the problem
statement divided by the number of Words in the problem statement. The
division is integer division. If the number of Words is 0, the Average Word
Length is 0.

Implement a class HowEasy, which contains a method pointVal. The method takes
a String as a parameter that is the problem statement and returns an int that
is the point value of the problem (250, 500, or 1000). The problem statement
should be processed from left to right.

Here is the method signature (be sure your method is public):
int pointVal(String problemStatement);

problemStatement is a String containing between 1 and 50 letters, numbers,
spaces, or periods. TopCoder will ensure the input is valid.

Examples:

If problemStatement="This is a problem statement", the Average Word Length is
23/5=4, so the method should return 500.
If problemStatement="523hi.", there are no Words, so the Average Word Length is
0, and the method should return 250.
If problemStatement="Implement a class H5 which contains some method." the
Average Word Length is 38/7=5 and the method should return 500.
If problemStatement=" no9 . wor7ds he8re. hj.." the Average Word Length is 0,
and the method should return 250.
Definition
????
Class:
HowEasy
Method:
pointVal
Parameters:
string
Returns:
int
Method signature:
int pointVal(string param0)
(be sure your method is public)
???

[此贴子已经被作者于2007-3-21 22:33:25编辑过]

搜索更多相关主题的帖子: difficulty problems programs decided process 
2007-03-21 22:31
PcrazyC
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:5652
专家分:0
注 册:2006-10-20
收藏
得分:0 
唉,怎么上英语课被老师批了,正在气头上呢

雁无留踪之意,水无取影之心
2007-03-21 22:46
高达
Rank: 1
等 级:新手上路
威 望:1
帖 子:261
专家分:0
注 册:2006-10-27
收藏
得分:0 
看不懂英文

哎 时间....................
2007-03-22 14:55
爱以走远
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:52
帖 子:7542
专家分:21
注 册:2007-3-16
收藏
得分:0 
怎么是英文版的哦
看不懂

   好好活着,因为我们会死很久!!!
2007-03-22 15:07
zhaoyg
Rank: 1
等 级:新手上路
帖 子:328
专家分:0
注 册:2006-8-28
收藏
得分:0 

像google,topcoder这样的公司都一样
谁叫人家是外国的


麻雀飞上枝头变凤凰,而菜鸟的我飞上枝头却感冒了,为什么我的脑袋如此的不管用呢。
2007-03-22 16:14
快速回复:在网上找到的一个题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020527 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved