惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志
博客园_首页
Last Week in AI
Last Week in AI
月光博客
月光博客
D
DataBreaches.Net
WordPress大学
WordPress大学
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 叶小钗
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
U
Unit 42
Recent Announcements
Recent Announcements
宝玉的分享
宝玉的分享
MyScale Blog
MyScale Blog
C
Check Point Blog
F
Fortinet All Blogs
B
Blog
小众软件
小众软件
Vercel News
Vercel News
罗磊的独立博客
有赞技术团队
有赞技术团队

博客园 - 空军

过多边形边上某点的任意直线等分面积 VisualAPL Installer for Visual Studio 2008 [ZT] Create a Microsoft Access Database Using ADOX and Visual Basic .NET 数的分解,据说是清华的一道复试上机题 为System.Windows.Forms.FontDialog类添加Location属性 f(f(x)) = -x [zt]〖Math〗构造函数使得任意小的区间所对应的值域都是整个实数域 [zt]鸟巢、水立方:同一个地方,同一梦想 〖Math〗据传,任意锐角等于0° 爱因斯坦的超级问题(谁养鱼)SQL解法 “槑囧圐圙”您认得这些汉字吗? 根据URL提取页面的Title,根据网页的charset自动判断Encoding MSDN“MidpointRounding 枚举”中文翻译有误 C# 2.0 新特性(泛型、可空类型)应用一例 表达式计算器 Google速记 Google中国编程挑战赛资格赛 数学家 数据库访问模块
Google中国编程挑战赛第一轮
空军 · 2005-12-20 · via 博客园 - 空军

Google™ Code Jam 中国编程挑战赛第一轮2005年12月19日21时在线举行,3道难度不同的题目,分数各为250、500和1000,难度高的题目分数较高,编码时间75分钟。

Round 1 Problem 250 Statement

You want to buy two neighboring tickets 

in the first row of the theater so that one of the tickets is as far from the aisles as possible.
You will be given a String describing the first row of the theater where 
'.' represents an empty seat and 'X' represents an occupied seat. Your task is to return the index (from 0) of the empty seat that is furthest from the aisles (the two ends of the String) and is also next to an empty seat. If there are multiple possible seats, return the one with the smallest index. Return -1 if there are no seats that satisfy your requirements.
Definition

Class:
TheaterVisit
Method:
chooseSeat
Parameters:

string
Returns:
int
Method signature:
int chooseSeat(string row)
(be sure your method 
is public)

Constraints

-
row will contain between 
1 and 50 characters, inclusive.
-
Each character 
in row will be either '.' or 'X'.

Examples

0)"....."
Returns: 
2
You can buy either tickets with indexes 
1 and 2 or tickets with indexes 2 and 3.1)"......"
Returns: 
22)"..X..."
Returns: 
3
You should buy tickets with indexes 
3 and 4.3)".X.X..."
Returns: 
44)"X.XX.X"
Returns: 
-15)".."
Returns: 
0

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.

Round 1 Problem 500 Statement

A group of vertical blocks are placed densely one after another on the ground. The blocks each have a width of 

1, but their heights may vary. For example, if the heights of the vertical blocks are given as {1,5,5,1,6,1}, the configuration would look like the following picture:
    □
 □□ □
 □□ □
 □□ □
 □□ □
□□□□□□
Your task 
is to reproduce the exact shape of this structure using some number of non-intersecting rectangles. You will be given a int[] heights representing the heights of the vertical blocks from left to right. Return the minimal number of rectangles necessary to perform this task with the given configuration of blocks.

Definition

Class:
BlockStructure
Method:
cover
Parameters:

int[]
Returns:
int
Method signature:
int cover(int[] heights)
(be sure your method 
is public)

Constraints

-
heights will have between 
1 and 50 elements, inclusive.
-
Each element of heights will be between 
1 and 1000, inclusive.

Examples

0)

{

1,5,5,1,6,1}
Returns: 
3
    ◇
 □□ ◇
 □□ ◇
 □□ ◇
 □□ ◇
■■■■■■
We can use rectangles with sizes 6x1, 2x4 and 1x5.
1)

{

2,2,2,4,4}
Returns: 
2
   ■■
   ■■
□□□■■
□□□■■
We can use a 3x2 rectangle and a 2x4 rectangle.
2)

{

6,6,6,6,6,6}
Returns: 
1
The structure 
is a rectangle.3)

{

71,44,95,16,10,80,12,17,98,61}
Returns: 
10
It
's impossible to use less than 10 rectangles.

4)

{

100,100,97,100,100,100,97,98,99,99}
Returns: 
5

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.

Round 1 Problem 1000 Statement

We have a sequence of integers, and we would like to remove all duplicate elements from 

this sequence. There may be multiple ways to perform this task. For example, given the sequence { 1213 }, we could end up with either { 123 } or { 213 } as the remaining sequence, depending on which duplicate 1 we remove from the original sequence. For this problem, we want to return the lexicographically first of of all possible remaining sequences. A sequence S1 comes before sequence S2 lexicographically if and only if S1 has a smaller value than S2 at the lowest index at which the two sequences differ (so, for example, { 123 } comes before { 231 }).
You will be given a 
int[] sequence. Return a int[] containing the sequence after all the duplicates are removed. See the examples for further clarification.

Definition

Class:
HardDuplicateRemover
Method:
process
Parameters:

int[]
Returns:
int[]
Method signature:
int[] process(int[] sequence)
(be sure your method 
is public)

Constraints

-
sequence will have between 
1 and 50 elements, inclusive.
-
Each element of sequence will be between 
1 and 1000, inclusive.

Examples

0)

{

565165}
Returns: {
165 }
There are six different ways to remove duplicates (remaining numbers are marked by 
'*'):
*5*6,  5*1,  6,  5},
*5,  6,  5*1*6,  5},
{  
5*6*5*1,  6,  5},
{  
5,  6*5*1*6,  5},
{  
5*6,  5*1,  6*5},
{  
5,  6,  5*1*6*5}.

The last variant 

is the lexicographically first.1)

{

324244}
Returns: {
324 }2)

{

666666}
Returns: {
6 }3)

{

132423}
Returns: {
1243 }4)

{

5415}
Returns: {
415 }

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.