我来我网
https://5come5.cn
 
您尚未 登录  注册 | 菠菜 | 软件站 | 音乐站 | 邮箱1 | 邮箱2 | 风格选择 | 更多 » 
 

本页主题: Google CodeJam2006 Qualification Round :: Problems 显示签名 | 打印 | 加为IE收藏 | 收藏主题 | 上一主题 | 下一主题

minpayne



性别: 帅哥 状态: 该用户目前不在线
头衔: ...pure love...
等级: 字幕组
家族: 燕窝
发贴: 1747
威望: 5
浮云: 205
在线等级:
注册时间: 2005-09-20
最后登陆: 2008-04-06

5come5帮你背单词 [ stall /sto:l/ n. 货摊,畜舍 ]


Google CodeJam2006 Qualification Round :: Problems

Problem Statement
 
You are given a int[] f that describes a set of values from a function f. The x-th element (zero-indexed) is the value of f(x). The function is not convex at a particular x value if there exist y and z values such that y < x < z, and the point (x, f(x)) lies strictly above the line between points (y, f(y)) and (z, f(z)) in the Cartesian plane. All x, y, and z values must be between 0 and n-1, inclusive, where n is the number of elements in f. Return the number of places where f is not convex.
Definition
 
Class:
ConvexityIssues
Method:
howMany
Parameters:
int[]
Returns:
int
Method signature:
int howMany(int[] values)
(be sure your method is public)
 

Constraints
-
f will contain between 3 and 50 elements, inclusive.
-
Each element of f will be between -1000 and 1000, inclusive.
Examples
0)

 
{0,1,4,9,16,25}
Returns: 0
The function is convex at all given points.
1)

 
{0,2,2}
Returns: 1
The point (1,2) is not below the line from (0,0) to (2,2).
2)

 
{1, 2, 3, 4, 5, 6, 7, 8}
Returns: 0

3)

 
{-1000, -501, 0, 500, 1000}
Returns: 2

4)

 
{-1000, 1, 1000}
Returns: 1


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2003, TopCoder, Inc. All rights reserved.

------------------------------------------------------------------------------------------------------------250分
本帖最近评分记录:
  • 浮云:10 (by kangtalc)
  • 顶端 Posted: 2006-09-08 17:45 | [楼 主]
    kangtalc



    性别: 帅哥 状态: 该用户目前不在线
    头衔: 揍敌客·奇犽
    等级: 希望之光
    家族: 万人坑恋影部落
    发贴: 1723
    威望: 5
    浮云: 1113
    在线等级:
    注册时间: 2005-09-21
    最后登陆: 2008-06-29

    5come5帮你背单词 [ monarch /'monək/ n. 君主,最高统治者 ]


    我名到是报了,就是那天一直在上课,没参加.(其实本来我实力就还不行,所以参不参加也无所谓了,呵呵:)
    顶端 Posted: 2006-09-09 16:12 | [1 楼]
    我来我网·5come5 Forum » 程序员之家

    Total 0.017748(s) query 8, Time now is:05-21 18:50, Gzip enabled
    Powered by PHPWind v5.3, Localized by 5come5 Tech Team, 黔ICP备16009856号