锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲av成人一区二区三区在线观看,亚洲精品免费视频,内射少妇36P亚洲区http://www.tkk7.com/emu/articles/327759.htmlemuemuMon, 02 Aug 2010 08:49:00 GMThttp://www.tkk7.com/emu/articles/327759.htmlhttp://www.tkk7.com/emu/comments/327759.htmlhttp://www.tkk7.com/emu/articles/327759.html#Feedback2http://www.tkk7.com/emu/comments/commentRss/327759.htmlhttp://www.tkk7.com/emu/services/trackbacks/327759.html
寮濮嬭佹媴蹇冩孩鍑洪棶棰橈紝鏈綆鍗曠殑鏂規硶涓嶆暍鐢紝鑰佹兂鍙﹁緹韞婂緞銆傛渶鍚庡彂鐜版媴蹇冩槸澶氫綑鐨勶紝榪欓噷闇瑕佺敤鍒扮殑鏁板彧鏄◢寰秴榪?2浣嶈屽凡錛屽ぇ澶氭暟楂樼駭璇█閮借兘寰堣交鏉劇殑澶勭悊64浣嶅ぇ鏁存暟錛岃繛javascript涔熷彲浠ュ鐞?4浣嶇殑澶ф暣鏁拌屼笉涓㈠け綺懼害錛岃繙榪滆秴榪囦簡榪欎釜闂鐨勮妯°?br />
榪欓噷鐗瑰湴鎶婅綆楄寖鍥存墿澶т簡5鍊嶆潵媯楠屾孩鍑洪棶棰樸傝妯″啀澶х殑鏃跺欐垜鐨処E璁$畻鏃墮棿瓚呰繃5縐掑紑濮嬭璀﹀憡浜嗐備負浜嗕唬鐮佺畝媧侊紝鎵撲貢嬈″簭浣跨敤浜嗘晥鐜囧緢浣庣殑sort鏂規硶錛屽ぇ閲忕殑鏃墮棿閮芥秷鑰楀湪榪欎竴姝ャ傛妸鎺掑簭鍙傛暟璋冩暣涓?.8錛堣屼笉鏄?.5錛変富瑕佹槸涓轟簡鍑忓皯鎺掑簭璁$畻閲忋?br />
<HTML>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--
var n=500000;//n鏄父鏁?涓嶇畻涓存椂鍙橀噺銆?/span>
var ar=[];//榪欐槸杈撳叆鏁版嵁錛屼笉綆椾復鏃跺彉閲?/span>
for(var i=0;i<n;i++){
    ar.push(i
+1)
}
//i鏄敓鎴愯緭鍏ユ暟鎹嬌鐢ㄧ殑錛屼笉綆椾復鏃跺彉閲?/span>
//
闅忔満鎶藉彇鎺変袱涓暟
document.write("鎶芥帀鐨勭1涓暟鏄細"+ar.splice(Math.floor(Math.random()*ar.length),1))
document.write(
"<br>鎶芥帀鐨勭2涓暟鏄細"+ar.splice(Math.floor(Math.random()*ar.length),1))
//鎵撲貢欏哄簭
ar.sort(function(){return Math.random()-.8})
//浣跨敤浜?涓復鏃跺彉閲?/span>
var t1=0,t2=0,t3;
for(t3=ar.length-1;t3>=0;t3--){
    t1
=t1+ar[t3];
    t2
=t2+(t3+1)*(t3+1)-ar[t3]*ar[t3];
}
t2
=t2+n*n*2-n*2+1;
document.write(
"<br>璁$畻寰楀埌涓や釜鏁版槸錛?lt;br>"+(((n+1)*n/2-t1)+Math.sqrt(2*(t2)-((n+1)*n/2-t1)*((n+1)*n/2-t1)))/2+"<br>"+(((n+1)*n/2-t1)-Math.sqrt(2*(t2)-((n+1)*n/2-t1)*((n+1)*n/2-t1)))/2)
//-->
</SCRIPT>
</BODY>
</HTML>


emu 2010-08-02 16:49 鍙戣〃璇勮
]]>
1000鍒嗘ā鎷熼CraneWork http://www.tkk7.com/emu/articles/67748.htmlemuemuTue, 05 Sep 2006 02:21:00 GMThttp://www.tkk7.com/emu/articles/67748.htmlhttp://www.tkk7.com/emu/comments/67748.htmlhttp://www.tkk7.com/emu/articles/67748.html#Feedback7http://www.tkk7.com/emu/comments/commentRss/67748.htmlhttp://www.tkk7.com/emu/services/trackbacks/67748.html

Problem Statement

聽聽聽聽 There are three stacks of crates - two of them outside of the warehouse, and one inside the warehouse. We have a crane that can move one crate at a time, and we would like to move all of the crates to the stack inside the warehouse. A heavier crate can never be stacked on top of a lighter crate, and all three initial stacks obey that rule.

Create a class CraneWork that contains a method moves that is given int[]s stack1, stack2, and warehouse containing the initial three stacks, and returns the minimum number of moves required to move all the crates into the warehouse stack. The elements of stack1, stack2, and warehouse represent the weights of the crates and are given from top to bottom (and thus in non-decreasing order of weight).

Definition

聽聽聽聽
Class: CraneWork
Method: moves
Parameters: int[], int[], int[]
Returns: int
Method signature: int moves(int[] stack1, int[] stack2, int[] warehouse)
(be sure your method is public)
聽聽聽聽

Constraints

- stack1, stack2, and warehouse will each contain between 0 and 20 elements, inclusive. - The total number of elements in the three stacks will be between 1 and 20, inclusive. - Each element in the three stacks will be between 1 and 200, inclusive. - stack1, stack2, and warehouse will each be in non-decreasing order.

Examples

0) 聽聽聽聽
{3,50}
{}
{1,2,50,50,50}
Returns: 12
Move 3 to stack2, 1 to stack1, 2 to stack2, 1 to stack2, 50 to warehouse, 1 to warehouse, 2 to stack1, 1 to stack1, 3 to warehouse, 1 to stack2, 2 to warehouse, 1 to warehouse.
1) 聽聽聽聽
{50}
{50}
{10,20,30}
Returns: 17
Start by moving 50 from stack2 to stack1. It then takes 7 moves to transfer the 10,20,30 to stack 2, 2 moves to transfer the 2 50's to the warehouse, and 7 more to transfer the 10,20,30 to the warehouse.
2) 聽聽聽聽
{}
{}
{2,5,6,7}
Returns: 0
All the crates are already in the warehouse.
3) 聽聽聽聽
{1,2,3}
{}
{}
Returns: 7
Move 1 from stack1 to warehouse, 2 from stack1 to stack2, 1 from warehouse to stack2, 3 from stack1 to warehouse, 1 from stack2 to stack1, 2 from stack2 to warehouse, 1 from stack1 to warehouse.

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.



emu 2006-09-05 10:21 鍙戣〃璇勮
]]>
500鍒嗘ā鎷熼 MaximalPalindromeSubstringshttp://www.tkk7.com/emu/articles/67745.htmlemuemuTue, 05 Sep 2006 02:20:00 GMThttp://www.tkk7.com/emu/articles/67745.htmlhttp://www.tkk7.com/emu/comments/67745.htmlhttp://www.tkk7.com/emu/articles/67745.html#Feedback3http://www.tkk7.com/emu/comments/commentRss/67745.htmlhttp://www.tkk7.com/emu/services/trackbacks/67745.html

Problem Statement

聽聽聽聽

A palindrome is a string that reads the same forward and backward. A palindrome substring is a contiguous sequence of characters taken from a string that form a palindrome. A palindrome substring of a string is maximal if we can't extend it to get a bigger palindrome substring. For example, string "acdadc" has 2 maximal palindrome substrings - "a" (the first one) and "cdadc". All other palindrome substrings (like "dad" or "c") can be extended to "cdadc", so they are not maximal.

You will be given a String[] str. Concatenate the elements of str to form one long string, and return the number of maximal palindrome substrings contained in that string.

Definition

聽聽聽聽
Class: MaximalPalindromeSubstrings
Method: countMaximalPalindromeSubstrings
Parameters: String[]
Returns: int
Method signature: int countMaximalPalindromeSubstrings(String[] str)
(be sure your method is public)
聽聽聽聽

Constraints

- str will contain between 1 and 50 elements, inclusive. - Each element of str will contain between 1 and 50 characters, inclusive. - Each character of each element of str will be a lowercase letter ('a'-'z').

Examples

0) 聽聽聽聽
{"acdadc"}
Returns: 2
The example from the problem statement.
1) 聽聽聽聽
{"ababab"}
Returns: 2
The two maximal palindrome substrings here are "ababa" and "babab".
2) 聽聽聽聽
{"aaaa","bbb","axxx"}
Returns: 3
Remember to use the whole input!
3) 聽聽聽聽
{"abacabbacaacdbdcacxcbbbbcabababacccbazhhaahh"}
Returns: 14

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.



emu 2006-09-05 10:20 鍙戣〃璇勮
]]>
250鍒嗘ā鎷熼 SalesRoutinghttp://www.tkk7.com/emu/articles/67744.htmlemuemuTue, 05 Sep 2006 02:19:00 GMThttp://www.tkk7.com/emu/articles/67744.htmlhttp://www.tkk7.com/emu/comments/67744.htmlhttp://www.tkk7.com/emu/articles/67744.html#Feedback4http://www.tkk7.com/emu/comments/commentRss/67744.htmlhttp://www.tkk7.com/emu/services/trackbacks/67744.html

Problem Statement

聽聽聽聽 You want to send a group of salespeople from location 0 to location 1, but no two of them can travel through the same location (other than 0 and 1). This removes the possibility of trying to sell a customer the same product twice. Character j of element i (both 0-based) of adj denotes whether locations i and j are connected by a symmetric link ('1' for connected, '0' otherwise). Return the greatest number of salespeople that can be sent. The constraints will guarantee that locations 0 and 1 do not share a link.

Definition

聽聽聽聽
Class: SalesRouting
Method: howMany
Parameters: String[]
Returns: int
Method signature: int howMany(String[] adj)
(be sure your method is public)
聽聽聽聽

Constraints

- adj will contain between 3 and 12 elements, inclusive. - Each element of adj will contain exactly N characters, where N is the number of elements in adj. - Each character in adj will be '0' (zero) or '1' (one). - Character i of element j of adj will be the same as character j of element i. - Character i of element i of adj will be '0'. - Character 1 of element 0 of adj will be '0'.

Examples

0) 聽聽聽聽
{
"001",
"001",
"110"
}
Returns: 1
We can send a single salesperson from location 0 to location 2, and finally to location 1.
1) 聽聽聽聽
{
"0010",
"0010",
"1100",
"0000"
}
Returns: 1
Same as before, but now there is an isolated location 3.
2) 聽聽聽聽
{
"001100",
"000001",
"100010",
"100010",
"001101",
"010010"
}
Returns: 1
The only location that is directly connected to location 1 is 5, so only 1 salesperson can be sent.
3) 聽聽聽聽
{
"001111",
"001111",
"110000",
"110000",
"110000",
"110000"
}
Returns: 4
4) 聽聽聽聽
{
"00000",
"00000",
"00000",
"00000",
"00000"
}
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.



emu 2006-09-05 10:19 鍙戣〃璇勮
]]>
SecretSum (code jam china round2 500鍒嗙湡棰?http://www.tkk7.com/emu/articles/25171.htmlemuemuFri, 23 Dec 2005 02:28:00 GMThttp://www.tkk7.com/emu/articles/25171.htmlhttp://www.tkk7.com/emu/comments/25171.htmlhttp://www.tkk7.com/emu/articles/25171.html#Feedback6http://www.tkk7.com/emu/comments/commentRss/25171.htmlhttp://www.tkk7.com/emu/services/trackbacks/25171.html

Problem Statement

    

We can substitute each digit of a number with a unique letter from 'A' to 'Z'. This way we can write groups of numbers in a single representation. For example "ABA" can represent any of the following: 101, 151, 343, 767, 929. However, "ABA" cannot mean 555 because each letter must stand for a distinct digit. Furthermore, numbers cannot begin with 0 and thus 'A' cannot be replaced by 0.

Given two such representations num1 and num2 and the result of their summation return the total number of possible combinations of numbers for which the equation holds. If no combinations are possible then return 0.

Definition

    
Class: SecretSum
Method: countPossible
Parameters: String, String, String
Returns: int
Method signature: int countPossible(String num1, String num2, String result)
(be sure your method is public)
    

Constraints

- num1, num2, and result will each contain exactly 3 uppercase letters ('A' - 'Z').

Examples

0)     
"AAA"
"BBB"
"CCC"
Returns: 32
1)     
"ABB"
"DEE"
"TTT"
Returns: 112
2)     
"ABC"
"ABA"
"ACC"
Returns: 0
Leading zeroes are not allowed.
3)     
"AAA"
"CDD"
"BAA"
Returns: 32
4)     
"TEF"
"FET"
"AAA"
Returns: 12
5)     
"ABC"
"ABC"
"BCE"
Returns: 5
We can have the following 5 sums:
124 + 124 = 248
125 + 125 = 250
249 + 249 = 498
374 + 374 = 748
375 + 375 = 750
6)     
"AAA"
"AAA"
"BBB"
Returns: 4
We can have the following 4 sums:
111 + 111 = 222
222 + 222 = 444
333 + 333 = 666
444 + 444 = 888

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.



emu 2005-12-23 10:28 鍙戣〃璇勮
]]>
FactorialSystem (code jam china round2 300鍒嗙湡棰?http://www.tkk7.com/emu/articles/25170.htmlemuemuFri, 23 Dec 2005 02:26:00 GMThttp://www.tkk7.com/emu/articles/25170.htmlhttp://www.tkk7.com/emu/comments/25170.htmlhttp://www.tkk7.com/emu/articles/25170.html#Feedback4http://www.tkk7.com/emu/comments/commentRss/25170.htmlhttp://www.tkk7.com/emu/services/trackbacks/25170.html

Problem Statement

    

In the factorial number system the value of the first digit (from the right) is 1!, the value of the second digit is 2!, ..., and the value of the n-th digit is n!. This means that any decimal number d can be written in this system as: anan-1...a2a1, where

d = an * n! + an-1 * (n-1)! + ... + a2 * 2! + a1 * 1! and 0 <= ai <= i for all i.

Given an int num in decimal, return its representation in the factorial number system.

Definition

    
Class: FactorialSystem
Method: convert
Parameters: int
Returns: int
Method signature: int convert(int num)
(be sure your method is public)
    

Notes

- n! = 1 * 2 * ... * n

Constraints

- num will be between 1 and 3628799 (10!-1), inclusive.

Examples

0)     
1
Returns: 1
1)     
24
Returns: 1000
24 = 4!
2)     
153
Returns: 11111
153 = 1! + 2! + 3! + 4! + 5!.
3)     
133
Returns: 10201
4)     
3628799
Returns: 987654321
Largest possible input.

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.



emu 2005-12-23 10:26 鍙戣〃璇勮
]]>
RecurringNumbers (code jam china 1000鍒嗙湡棰?http://www.tkk7.com/emu/articles/25151.htmlemuemuFri, 23 Dec 2005 01:30:00 GMThttp://www.tkk7.com/emu/articles/25151.htmlhttp://www.tkk7.com/emu/comments/25151.htmlhttp://www.tkk7.com/emu/articles/25151.html#Feedback2http://www.tkk7.com/emu/comments/commentRss/25151.htmlhttp://www.tkk7.com/emu/services/trackbacks/25151.html

Problem Statement

    

A rational number is defined as a/b, where a and b are integers, and b is greater than 0. Furthermore, a rational number can be written as a decimal that has a group of digits that repeat indefinitely. A common method of writing groups of repeating digits is to place them inside parentheses like 2.85(23) = 2.852323 ... 23...

Given a decimal representation of a rational number in decimalNumber, convert it to a fraction formatted as "numerator/denominator", where both numerator and denominator are integers. The fraction must be reduced. In other words, the denominator must be as small as possible, but greater than zero.

Definition

    
Class: RecurringNumbers
Method: convertToFraction
Parameters: String
Returns: String
Method signature: String convertToFraction(String decimalNumber)
(be sure your method is public)
    

Constraints

- decimalNumber will have between 3 and 10 characters inclusive. - decimalNumber will contain only characters '0' - '9', '.', '(' and ')'. - The second character in decimalNumber will always be '.'. - There will be at most one '(' and ')' in decimalNumber. - '(' in decimalNumber will be followed by one or more digits ('0' - '9'), followed by ')'. - ')' in decimalNumber will not be followed by any other character.

Examples

0)     
"0.(3)"
Returns: "1/3"
0.(3) = 0.333... = 1/3
1)     
"1.3125"
Returns: "21/16"
Note there are no recurring digits here, although we could write it as 1.3125(0) or 1.3124(9).
2)     
"2.85(23)"
Returns: "14119/4950"
2.85(23) = 2.852323... = 285/100 + 23/9900 = 28238/9900 = 14119/4950. Make sure to reduce the fraction, as shown in the final step.
3)     
"9.123(456)"
Returns: "3038111/333000"
4)     
"0.111(1)"
Returns: "1/9"
5)     
"3.(000)"
Returns: "3/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.



emu 2005-12-23 09:30 鍙戣〃璇勮
]]>
google涓浗緙栫▼鎸戞垬璧涘叆鍥磋禌鐪熼 -- HardDuplicateRemover(1000鍒? http://www.tkk7.com/emu/articles/24723.htmlemuemuTue, 20 Dec 2005 02:29:00 GMThttp://www.tkk7.com/emu/articles/24723.htmlhttp://www.tkk7.com/emu/comments/24723.htmlhttp://www.tkk7.com/emu/articles/24723.html#Feedback9http://www.tkk7.com/emu/comments/commentRss/24723.htmlhttp://www.tkk7.com/emu/services/trackbacks/24723.htmlProblem 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 { 1, 2, 1, 3 }, we could end up with either { 1, 2, 3 } or { 2, 1, 3 } 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, { 1, 2, 3 } comes before { 2, 3, 1 }).
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)

????
{5, 6, 5, 1, 6, 5}
Returns: {1, 6, 5 }
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)

????
{3, 2, 4, 2, 4, 4}
Returns: {3, 2, 4 }

2)

????
{6, 6, 6, 6, 6, 6}
Returns: {6 }

3)

????
{1, 3, 2, 4, 2, 3}
Returns: {1, 2, 4, 3 }

4)

????
{5, 4, 1, 5}
Returns: {4, 1, 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.



emu 2005-12-20 10:29 鍙戣〃璇勮
]]>
google涓浗緙栫▼鎸戞垬璧涘叆鍥磋禌鐪熼 -- BlockStructure(500鍒? http://www.tkk7.com/emu/articles/24722.htmlemuemuTue, 20 Dec 2005 02:28:00 GMThttp://www.tkk7.com/emu/articles/24722.htmlhttp://www.tkk7.com/emu/comments/24722.htmlhttp://www.tkk7.com/emu/articles/24722.html#Feedback3http://www.tkk7.com/emu/comments/commentRss/24722.htmlhttp://www.tkk7.com/emu/services/trackbacks/24722.htmlProblem 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.



emu 2005-12-20 10:28 鍙戣〃璇勮
]]>
google涓浗緙栫▼鎸戞垬璧涘叆鍥磋禌鐪熼 -- TheaterVisit(250鍒? http://www.tkk7.com/emu/articles/24721.htmlemuemuTue, 20 Dec 2005 02:27:00 GMThttp://www.tkk7.com/emu/articles/24721.htmlhttp://www.tkk7.com/emu/comments/24721.htmlhttp://www.tkk7.com/emu/articles/24721.html#Feedback0http://www.tkk7.com/emu/comments/commentRss/24721.htmlhttp://www.tkk7.com/emu/services/trackbacks/24721.htmlProblem 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: 2

2)

????
"..X..."
Returns: 3
You should buy tickets with indexes 3 and 4.
3)

????
".X.X..."
Returns: 4

4)

????
"X.XX.X"
Returns: -1

5)

????
".."
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.



emu 2005-12-20 10:27 鍙戣〃璇勮
]]>
google涓浗緙栫▼鎸戞垬璧涜祫鏍艱禌鐪熼 -- SkipStones (鏈嬪弸杞繃鏉ョ殑鏃跺欓『渚跨粰緲昏瘧浜?http://www.tkk7.com/emu/articles/23647.htmlemuemuTue, 13 Dec 2005 05:39:00 GMThttp://www.tkk7.com/emu/articles/23647.htmlhttp://www.tkk7.com/emu/comments/23647.htmlhttp://www.tkk7.com/emu/articles/23647.html#Feedback4http://www.tkk7.com/emu/comments/commentRss/23647.htmlhttp://www.tkk7.com/emu/services/trackbacks/23647.htmlSkipStones 
Problem Statement 闂鎻忚堪

When a stone is thrown across water, sometimes it will land on the water and bounce rather than falling in right away. Suppose that a stone is thrown a distance of n. On each successive bounce it will travel half the distance as the previous bounce (rounded down to the nearest integer). When it can not travel any further, it falls into the water. If, at any point, the stone lands on an obstruction rather than water, it will not bounce, but will simply deflect and fall into the water. Please look at the figure for further clarification (with black, red and green cells representing banks, obstructions and free water respectively). So, if the stone is thrown a distance 7, it will bounce and travel a distance of 3, then finally a distance of 1, having travelled a total distance of 11 (the green path in the figure). If a stone is thrown a distance of 8, it will reach the opposite bank, and if thrown at distances of 2 or 6 it will hit an obstruction during its travel. These are the three red paths in the figure.

You are given a String water. An 鈥榅鈥?represents an obstruction, while a 鈥?鈥?BR>represents water free from obstruction. You are to return an int representing
the maximum distance a stone can travel and finally fall in the water, without
hitting any obstructions, and without reaching the opposite bank (going beyond
the end of the string). You may choose any initial distance for the throw,
which starts from the left side of the string. A distance of 1 is the first
character of the string, etc. If no initial throw will result in the stone
landing in the water without hitting an obstruction, return 0.

緇欎簣涓涓?String 杈撳叆錛歸ater. 鍏跺唴鈥橷'瀛楃浠h〃紺佺煶錛屸?鈥?浠h〃鏃犵鐭蟲按闈€備綘鐨勭▼搴?BR>榪斿洖涓涓暣鏁癷nt錛岃〃紺鴻鐭沖ご鍦ㄦ渶緇堣惤鍏ユ按涓殑鎯呭喌涓嬭繍琛岀殑鎬繪渶澶ц窛紱伙紝瑙︾銆佹挒宀哥殑
鎯呭艦閮藉繀欏繪帓闄ゃ傚叾涓挒宀歌〃寰佷負 (瀛楃涓茶闂秺涓婄晫). 浣犲彲浠ラ夋嫨浠諱綍鍒濆鐨勬姇鎺瘋窛紱?BR>錛屽嚭鍙戠偣涓哄瓧絎︿覆鏈宸︿晶銆傝窛紱諱負1鍒欐姷杈懼瓧絎︿覆鐨勭涓涓瓧絎︼紝渚濇綾繪帹銆傚鏋滄病鏈夋姇鎺?BR>璺濈錛岀煶澶磋褰撲綔鐩存帴鍏ユ按錛岃繑鍥為噺涓?銆?/P>

瀹氫箟錛?/P>

Class:
SkipStones
Method:
maxDistance
Parameters:
String
Returns:
int
Method signature:
int maxDistance(String water)
(紜繚浣犵殑鍑芥暟涓哄叕鍏辯被鍨?public)

娉細
紺佺煶澶勫湪姘撮潰錛屾墍浠ヤ笉瀛樺湪鐭沖ご鍏ユ按鍚庢挒紺佺殑鎯呭艦銆?/P>

闄愬埗鏉′歡錛?
water 瀛楃涓插寘鍚?鍒?0涓厓绱燵鍗崇鐭蟲垨姘撮潰]錛?銆?0鍖呭惈鍦ㄥ唴銆?BR>water鐨勬瘡涓厓绱犲寘鍚?鍒?0涓瓧絎? 1銆?0鍖呭惈鍦ㄥ唴銆?BR>water鐨勬瘡涓厓绱犵殑姣忎釜瀛楃瑕佷箞鏄橷'錛岃涔堟槸 鈥?鈥?

嫻嬭瘯渚嬪瓙

0)

鈥?.X鈥?.X鈥︹?BR>榪斿洖: 11
璇ヤ緥姝e棰樼洰涓紙緇胯壊杞ㄨ抗錛夋墍鍥劇ず銆?/P>

1)

鈥溾鈥︹?BR>榪斿洖: 3
鍋囧娌℃湁璇ョ鐭?鍙互鎵斾竴璺濈4,浠庤屾昏窛紱諱負7銆備絾鍦ㄦ湁紺佺煶鎯呭艦涓嬶紝鏈浣沖垯鏄墧鍑鴻窛紱?

錛屽啀璺?鑰屽仠姝€?/P>

2)

鈥溾?X鈥?X鈥XXX.X鈥?.鈥?BR>榪斿洖: 22
12 + 6 + 3 + 1 = 22, 涓烘渶浣崇粨鏋?

3)

鈥淴XXXXXX.XXX.X..鈥?BR>榪斿洖: 15



emu 2005-12-13 13:39 鍙戣〃璇勮
]]>
google涓浗緙栫▼鎸戞垬璧涜祫鏍艱禌鐪熼 -- ReverseSubstring http://www.tkk7.com/emu/articles/23646.htmlemuemuTue, 13 Dec 2005 05:35:00 GMThttp://www.tkk7.com/emu/articles/23646.htmlhttp://www.tkk7.com/emu/comments/23646.htmlhttp://www.tkk7.com/emu/articles/23646.html#Feedback5http://www.tkk7.com/emu/comments/commentRss/23646.htmlhttp://www.tkk7.com/emu/services/trackbacks/23646.html ReverseSubstring You are given a String input. You are to find the longest substring of 
input such that the reversal of the substring is also a substring of 
input. In case of a tie, return the string that occurs earliest in 
input. 
Definition 
緇欎綘涓涓瓧絎︿覆錛屼綘鍐嶇敓鎴愪竴涓鍊掔殑瀛楃涓詫紝浠庡師涓蹭腑鎵懼嚭浠繪剰瀛愪覆鑳藉悓鏃跺瓨鍦ㄩ鍊掔殑瀛楃涓蹭腑錛?nbsp;
姹傚嚭鏈闀垮瓙涓?nbsp;
Class: 
ReverseSubstring 
Method: 
findReversed 
Parameters: 
String 
Returns: 
String 
Method signature: 
String findReversed(String input) 
(be sure your method is public) 
綾籖everseSubstring鏂規硶  public String findReversed(String input) 


Notes 

The substring and its reversal may overlap partially or completely. 

The entire original string is itself a valid substring (see example 4). 
Constraints 

input will contain between 1 and 50 characters, inclusive. 

Each character of input will be an uppercase letter ('A'-'Z'). 
Examples 
0) 


"XBCDEFYWFEDCBZ" 
Returns: "BCDEF" 
We see that the reverse of BCDEF is FEDCB, which appears later in the 
string. 
棰犲掔殑瀛楃涓蹭負"ZBCDEFWYFEDCBX"錛屽師涓蹭腑BCDEF涔熸槸棰犲掔殑瀛楃涓茬殑瀛愪覆錛屽茍涓斾負鏈闀跨殑 
1) 


"XYZ" 
Returns: "X" 
The best we can do is find a one character substring, so we implement 
the tie-breaker rule of taking the earliest one first. 
2) 


"ABCABA" 
Returns: "ABA" 
The string ABA is a palindrome (it's its own reversal), so it meets the 
criteria. 
3) 


"FDASJKUREKJFDFASIREYUFDHSAJYIREWQ" 
Returns: "FDF" 


4) 


"ABCDCBA" 
Returns: "ABCDCBA" 
Here, the entire string is its own reversal. 
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.

emu 2005-12-13 13:35 鍙戣〃璇勮
]]>
google涓浗緙栫▼鎸戞垬璧涜祫鏍艱禌鐪熼 -- PlayCards http://www.tkk7.com/emu/articles/23645.htmlemuemuTue, 13 Dec 2005 05:34:00 GMThttp://www.tkk7.com/emu/articles/23645.htmlhttp://www.tkk7.com/emu/comments/23645.htmlhttp://www.tkk7.com/emu/articles/23645.html#Feedback15http://www.tkk7.com/emu/comments/commentRss/23645.htmlhttp://www.tkk7.com/emu/services/trackbacks/23645.html PlayCards Problem Statement

You are playing a card game, and in your hand, you are holding several cards. Each card has a suit,
'S', 'H', 'D', or 'C',and a value between 1 and 10, inclusive. You may play cards as part of a set,
which is three or more cards of the same value,or as part of a run, which is three or more cards 
of the same suit, in sequential order. (Runs may not wrap, thus, 9-10-1 is not a valid run.) Each 
card may be played only once.For example, "1 S", "1 H" and "1 D" would be a valid set. "2 S", "3 S",
and "4 S" would be a valid run.You want to play as many cards as possible, maybe in several plays 
(see example 4). Given a String[] cards representing the cards held in your hand, you are to return 
an int indicating the maximum number of cards you can play. Each card will be given in the form 
"value suit" (quotes added for clarity).

Definition

Class:
PlayCards
Method:
maxCards
Parameters:
String[]
Returns:
int
Method signature:
int maxCards(String[] cards)
(be sure your method is public)


Constraints
-
cards will contain between 0 and 20 elements, inclusive.
-
No two elements of cards will be the same.
-
Each element of cards will be of the form "value suit" (quotes added for clarity).
-
Each number represented will be between 1 and 10, inclusive, with no leading zeroes.
-
Each suit represented will be 'S', 'H', 'D', or 'C'.
Examples
0)


{"1 S", "2 S", "3 S"}
Returns: 3
We have a run of three cards, which we can play.
1)


{"4 C", "4 D", "4 S", "3 S", "2 S"}
Returns: 3
We can take the 4's as a set, or we can take the 2-3-4 run. Either way, we play 3 cards.
2)


{"1 S", "2 S", "2 H", "3 H", "3 D", "4 D", "4 C", "5 C", "5 S"}
Returns: 0
We've got lots of cards, but no way to put three together.
3)


{"1 S", "2 S"}
Returns: 0
Since we have to play at least three cards at a time, there's nothing to do here.
4)


{"1 S", "2 S", "10 S", "5 S", "8 S",
 "3 H", "9 H", "6 H", "5 H", "4 H",
 "10 D", "5 D", "7 D", "4 D", "1 D",
 "2 C", "4 C", "5 C", "6 C", "7 C"}
Returns: 9
The best we can do is to take the set of 4s, the 5-6-7 C, and the remaining three 5s. We could have taken
the 4-5-6-7 of C,or all four 5s, but we would not end up playing as many cards.

emu 2005-12-13 13:34 鍙戣〃璇勮
]]>
google涓浗緙栫▼鎸戞垬璧涜祫鏍艱禌鐪熼 -- DiskClustershttp://www.tkk7.com/emu/articles/23644.htmlemuemuTue, 13 Dec 2005 05:33:00 GMThttp://www.tkk7.com/emu/articles/23644.htmlhttp://www.tkk7.com/emu/comments/23644.htmlhttp://www.tkk7.com/emu/articles/23644.html#Feedback0http://www.tkk7.com/emu/comments/commentRss/23644.htmlhttp://www.tkk7.com/emu/services/trackbacks/23644.html DiskClusters Problem Statement

You are given a String disk representing the clusters on a disk. An 'X' represents a used cluster,
and a '.' represents an available cluster. You are also given an int size representing the size, 
in clusters, of a file waiting to be written to disk. A file can only be stored in clusters not already being used.
Return the minimum number of groups of consecutive clusters needed to store the file on the disk.
(The disk does not wrap around at the end.) Return -1 if the disk does not have enough space available
to store the file.
Definition

Class:
DiskClusters
Method:
minimumFragmentation
Parameters:
String, int
Returns:
int
Method signature:
int minimumFragmentation(String disk, int size)
(be sure your method is public)


Constraints
-
disk will contain between 1 and 50 characters, inclusive.
-
Each character of disk will be 'X' or '.'.
-
size will be between 1 and 50, inclusive.
Examples
0)


"."
2
Returns: -1
We can't fit the file on the disk.
1)


".XXXXXXXX.XXXXXX.XX.X.X."
6
Returns: 6
There is only ever one cluster together, so all six clusters are separated.
2)


"XX..XX....X.XX........X...X.XX...XXXX..XX...XXXXX."
12
Returns: 2
We fit eight clusters together, and four clusters together.
3)


".X.XXXX.......XX....X.....X............XX.X.....X."
20
Returns: 3

4)


"....X...X..X"
11
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.

emu 2005-12-13 13:33 鍙戣〃璇勮
]]>
google涓浗緙栫▼鎸戞垬璧涜祫鏍艱禌鐪熼 -- FillBaskets錛?50鍒嗭級 http://www.tkk7.com/emu/articles/23625.htmlemuemuTue, 13 Dec 2005 04:00:00 GMThttp://www.tkk7.com/emu/articles/23625.htmlhttp://www.tkk7.com/emu/comments/23625.htmlhttp://www.tkk7.com/emu/articles/23625.html#Feedback1http://www.tkk7.com/emu/comments/commentRss/23625.htmlhttp://www.tkk7.com/emu/services/trackbacks/23625.html鑰冭瘯鍒氬垰緇撴潫錛岄鐩笘鍑烘潵浜ゆ祦涓涓嬨?BR>Problem Statement
????
You have several identical balls that you wish to place in several baskets. Each basket has the same maximum capacity. You are given an int baskets, the number of baskets you have. You are given an int capacity, the maximum capacity of each basket. Finally you are given an int balls, the number of balls to sort into baskets. Return the number of ways you can divide the balls into baskets. If this cannot be done without exceeding the capacity of the baskets, return 0.
Each basket is distinct, but all balls are identical. Thus, if you have two balls to place into two baskets, you could have (0, 2), (1, 1), or (2, 0), so there would be three ways to do this.
Definition
????
Class:
FillBaskets
Method:
countWays
Parameters:
int, int, int
Returns:
int
Method signature:
int countWays(int baskets, int capacity, int balls)
(be sure your method is public)
????

Constraints
-
baskets will be between 1 and 5, inclusive.
-
capacity will be between 1 and 20, inclusive.
-
balls will be between 1 and 100, inclusive.
Examples
0)

????
2
20
2
Returns: 3
The example from the problem statement.
1)

????
3
20
1
Returns: 3
We have only 1 ball, so we must choose which of the three baskets to place it in.
2)

????
3
20
2
Returns: 6
We can place both balls in the same basket (3 ways to do this), or one ball in each of two baskets (3 ways to do this).
3)

????
1
5
10
Returns: 0
We have more balls than our basket can hold.
4)

????
4
5
10
Returns: 146

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.



emu 2005-12-13 12:00 鍙戣〃璇勮
]]>
google涓浗緙栫▼鎸戞垬璧涜祫鏍艱禌鐪熼 -- BusStops錛?50鍒嗭級 http://www.tkk7.com/emu/articles/23624.htmlemuemuTue, 13 Dec 2005 04:00:00 GMThttp://www.tkk7.com/emu/articles/23624.htmlhttp://www.tkk7.com/emu/comments/23624.htmlhttp://www.tkk7.com/emu/articles/23624.html#Feedback2http://www.tkk7.com/emu/comments/commentRss/23624.htmlhttp://www.tkk7.com/emu/services/trackbacks/23624.html鑰冭瘯鍒氬垰緇撴潫錛岄鐩笘鍑烘潵浜ゆ祦涓涓嬨?BR>Problem Statement
????
You are given a String[] cityMap representing the layout of a city. The city consists of blocks. The first element of cityMap represents the first row of blocks, etc. A 'B' character indicates a location where there is a bus stop. There will be exactly one 'X' character, indicating your location. All other characters will be '.'. You are also given an int walkingDistance, which is the maximum distance you are willing to walk to a bus stop. The distance should be calculated as the number of blocks vertically plus the number of blocks horizontally. Return the number of bus stops that are within walking distance of your current location.
Definition
????
Class:
BusStops
Method:
countStops
Parameters:
String[], int
Returns:
int
Method signature:
int countStops(String[] cityMap, int walkingDistance)
(be sure your method is public)
????

Constraints
-
cityMap will contain between 1 and 50 elements, inclusive.
-
Each element of cityMap will contain between 1 and 50 characters, inclusive.
-
Each element of cityMap will contain the same number of characters.
-
Each character of each element of cityMap will be 'B', 'X', or '.'.
-
There will be exactly one 'X' character in cityMap.
-
walkingDistance will be between 1 and 100, inclusive.
Examples
0)

????
{"...B.",
 ".....",
 "..X.B",
 ".....",
 "B...."}
3
Returns: 2
You can reach the bus stop at the top (3 units away), or on the right (2 units away). The one in the lower left is 4 units away, which is too far.
1)

????
{"B.B..",
 ".....",
 "B....",
 ".....",
 "....X"}
8
Returns: 3
A distance of 8 can get us anywhere on the map, so we can reach all 3 bus stops.
2)

????
{"BBBBB",
 "BB.BB",
 "B.X.B",
 "BB.BB",
 "BBBBB"}
1
Returns: 0
Plenty of bus stops, but unfortunately we cannot reach any of them.
3)

????
{"B..B..",
 ".B...B",
 "..B...",
 "..B.X.",
 "B.B.B.",
 ".B.B.B"}
3
Returns: 7

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.



emu 2005-12-13 12:00 鍙戣〃璇勮
]]>
google涓浗緙栫▼鎸戞垬璧涜祫鏍艱禌鐪熼 -- WordPath錛?50鍒嗭級 http://www.tkk7.com/emu/articles/23623.htmlemuemuTue, 13 Dec 2005 04:00:00 GMThttp://www.tkk7.com/emu/articles/23623.htmlhttp://www.tkk7.com/emu/comments/23623.htmlhttp://www.tkk7.com/emu/articles/23623.html#Feedback19http://www.tkk7.com/emu/comments/commentRss/23623.htmlhttp://www.tkk7.com/emu/services/trackbacks/23623.html鑰冭瘯鍒氬垰緇撴潫錛岄鐩笘鍑烘潵浜ゆ祦涓涓嬨?BR>Problem Statement
????
You are given a String[] grid representing a rectangular grid of letters. You are also given a String find, a word you are to find within the grid. The starting point may be anywhere in the grid. The path may move up, down, left, right, or diagonally from one letter to the next, and may use letters in the grid more than once, but you may not stay on the same cell twice in a row (see example 6 for clarification).
You are to return an int indicating the number of ways find can be found within the grid. If the result is more than 1,000,000,000, return -1.
Definition
????
Class:
WordPath
Method:
countPaths
Parameters:
String[], String
Returns:
int
Method signature:
int countPaths(String[] grid, String find)
(be sure your method is public)
????

Constraints
-
grid will contain between 1 and 50 elements, inclusive.
-
Each element of grid will contain between 1 and 50 uppercase ('A'-'Z') letters, inclusive.
-
Each element of grid will contain the same number of characters.
-
find will contain between 1 and 50 uppercase ('A'-'Z') letters, inclusive.
Examples
0)

????
{"ABC",
 "FED",
 "GHI"}
"ABCDEFGHI"
Returns: 1
There is only one way to trace this path. Each letter is used exactly once.
1)

????
{"ABC",
 "FED",
 "GAI"}
"ABCDEA"
Returns: 2
Once we get to the 'E', we can choose one of two directions for the final 'A'.
2)

????
{"ABC",
 "DEF",
 "GHI"}
"ABCD"
Returns: 0
We can trace a path for "ABC", but there's no way to complete a path to the letter 'D'.
3)

????
{"AA",
 "AA"}
"AAAA"
Returns: 108
We can start from any of the four locations. From each location, we can then move in any of the three possible directions for our second letter, and again for the third and fourth letter. 4 * 3 * 3 * 3 = 108.
4)

????
{"ABABA",
 "BABAB",
 "ABABA",
 "BABAB",
 "ABABA"}
"ABABABBA"
Returns: 56448
There are a lot of ways to trace this path.
5)

????
{"AAAAA",
 "AAAAA",
 "AAAAA",
 "AAAAA",
 "AAAAA"}
"AAAAAAAAAAA"
Returns: -1
There are well over 1,000,000,000 paths that can be traced.
6)

????
{"AB",
 "CD"}
"AA"
Returns: 0
Since we can't stay on the same cell, we can't trace the path at all.
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.



emu 2005-12-13 12:00 鍙戣〃璇勮
]]>
google涓浗緙栫▼鎸戞垬璧涙ā鎷熼 -- CursorPosition錛?000鍒嗭級http://www.tkk7.com/emu/articles/22130.htmlemuemuThu, 01 Dec 2005 08:57:00 GMThttp://www.tkk7.com/emu/articles/22130.htmlhttp://www.tkk7.com/emu/comments/22130.htmlhttp://www.tkk7.com/emu/articles/22130.html#Feedback6http://www.tkk7.com/emu/comments/commentRss/22130.htmlhttp://www.tkk7.com/emu/services/trackbacks/22130.html
Problem Statement
????
When editing a single line of text, there are four keys that can be used to move the cursor: end, home, left-arrow and right-arrow. As you would expect, left-arrow and right-arrow move the cursor one character left or one character right, unless the cursor is at the beginning of the line or the end of the line, respectively, in which case the keystrokes do nothing (the cursor does not wrap to the previous or next line). The home key moves the cursor to the beginning of the line, and the end key moves the cursor to the end of the line.  You will be given a int, N, representing the number of character in a line of text. The cursor is always between two adjacent characters, at the beginning of the line, or at the end of the line. It starts before the first character, at position 0. The position after the last character on the line is position N. You should simulate a series of keystrokes and return the final position of the cursor. You will be given a String where characters of the String represent the keystrokes made, in order. 'L' and 'R' represent left and right, while 'H' and 'E' represent home and end.
Definition
????
Class:
CursorPosition
Method:
getPosition
Parameters:
String, int
Returns:
int
Method signature:
int getPosition(String keystrokes, int N)
(be sure your method is public)
????

Constraints
-
keystrokes will be contain between 1 and 50 'L', 'R', 'H', and 'E' characters, inclusive.
-
N will be between 1 and 100, inclusive.
Examples
0)

????
"ERLLL"
10
Returns: 7
First, we go to the end of the line at position 10. Then, the right-arrow does nothing because we are already at the end of the line. Finally, three left-arrows brings us to position 7.
1)

????
"EHHEEHLLLLRRRRRR"
2
Returns: 2
All the right-arrows at the end ensure that we end up at the end of the line.
2)

????
"ELLLELLRRRRLRLRLLLRLLLRLLLLRLLRRRL"
10
Returns: 3

3)

????
"RRLEERLLLLRLLRLRRRLRLRLRLRLLLLL"
19
Returns: 12

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.



娌℃湁闅懼害

public class CursorPosition {
public int getPosition(String keystrokes, int N){
    
int p = 0;
    
if(keystrokes.lastIndexOf("H")>-1)
        keystrokes
=keystrokes.substring(keystrokes.lastIndexOf("H")+1);
    
if(keystrokes.lastIndexOf("E")>-1){
        keystrokes
=keystrokes.substring(keystrokes.lastIndexOf("E")+1);
        p
=N;
    }

    
for(int i=0;i<keystrokes.length();i++){
        
if(keystrokes.charAt(i)=='R')
            p
+=(p<N)?1:0;
        
else 
            p
-=(p>0)?1:0;
    }

    
return p;
}

public static void main(String[] args){
    System.out.println(
new CursorPosition().getPosition("ERLLL",10));
    System.out.println(
new CursorPosition().getPosition("EHHEEHLLLLRRRRRR",2));
    System.out.println(
new CursorPosition().getPosition("ELLLELLRRRRLRLRLLLRLLLRLLLLRLLRRRL",10));
    System.out.println(
new CursorPosition().getPosition("RRLEERLLLLRLLRLRRRLRLRLRLRLLLLL",19));
    System.out.println(
new CursorPosition().getPosition("R",9));

}

}



emu 2005-12-01 16:57 鍙戣〃璇勮
]]>
google涓浗緙栫▼鎸戞垬璧涙ā鎷熼 -- MatrixTool (500鍒?http://www.tkk7.com/emu/articles/22125.htmlemuemuThu, 01 Dec 2005 08:33:00 GMThttp://www.tkk7.com/emu/articles/22125.htmlhttp://www.tkk7.com/emu/comments/22125.htmlhttp://www.tkk7.com/emu/articles/22125.html#Feedback1http://www.tkk7.com/emu/comments/commentRss/22125.htmlhttp://www.tkk7.com/emu/services/trackbacks/22125.html
Problem Statement
????
A square matrix is a grid of NxN numbers. For example, the following is a 3x3 matrix:
 4 3 5
 2 4 5
 0 1 9
One way to represent a matrix of numbers, each of which is between 0 and 9 inclusive, is as a row-major String. To generate the String, simply concatenate all of the elements from the first row followed by the second row and so on, without any spaces. For example, the above matrix would be represented as "435245019".  You will be given a square matrix as a row-major String. Your task is to convert it into a String[], where each element represents one row of the original matrix. Element i of the String[] represents row i of the matrix. You should not include any spaces in your return. Hence, for the above String, you would return {"435","245","019"}. If the input does not represent a square matrix because the number of characters is not a perfect square, return an empty String[], {}.
Definition
????
Class:
MatrixTool
Method:
convert
Parameters:
String
Returns:
String[]
Method signature:
String[] convert(String s)
(be sure your method is public)
????

Constraints
-
s will contain between 1 and 50 digits, inclusive.
Examples
0)

????
"435245019"
Returns: {"435", "245", "019" }
The example above.
1)

????
"9"
Returns: {"9" }

2)

????
"0123456789"
Returns: { }
This input has 10 digits, and 10 is not a perfect square.
3)

????
"3357002966366183191503444273807479559869883303524"
Returns: {"3357002", "9663661", "8319150", "3444273", "8074795", "5986988", "3303524" }

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.



灞鎼炵瑧鐨勯鐩傝繖嬈′腑鍥介敠鏍囪禌鐨勬ā鎷熼姣旇搗涓婃涓滀簹鐨勫樊鐨勫お榪滀簡銆傝В涓涓惂錛?BR>

public class MatrixTool {
    
public String[] convert(String s){
        
int l = s.length();
        
int sq = new Double(Math.sqrt(l)).intValue();
        
if(sq*sq!=l)return new String[]{};
        String[] result 
= new String[sq];
        
for(int i=0;i<sq;i++)
            result[i]
=s.substring(i*sq,(i+1)*sq);
        
return result;
    }

    
public static void main(String[] args){
        String[] s;
        s 
= new MatrixTool().convert("435245019");
        System.out.println(java.util.Arrays.asList(s));
        s 
= new MatrixTool().convert("0123456789");
        System.out.println(java.util.Arrays.asList(s));
        s 
= new MatrixTool().convert("3357002966366183191503444273807479559869883303524");
        System.out.println(java.util.Arrays.asList(s));
    }

}


emu 2005-12-01 16:33 鍙戣〃璇勮
]]>
google涓浗緙栫▼鎸戞垬璧涙ā鎷熼 -- DrawLines (250鍒?http://www.tkk7.com/emu/articles/22085.htmlemuemuThu, 01 Dec 2005 02:37:00 GMThttp://www.tkk7.com/emu/articles/22085.htmlhttp://www.tkk7.com/emu/comments/22085.htmlhttp://www.tkk7.com/emu/articles/22085.html#Feedback0http://www.tkk7.com/emu/comments/commentRss/22085.htmlhttp://www.tkk7.com/emu/services/trackbacks/22085.htmlProblem Statement
    
A simple line drawing program uses a blank 20 x 20 pixel canvas and a directional cursor that starts at the upper left corner pointing straight down. The upper left corner of the canvas is at (0, 0) and the lower right corner is at (19, 19). You are given a String[], commands, each element of which contains one of two possible commands. A command of the form "FORWARD x" means that the cursor should move forward by x pixels. Each pixel on its path, including the start and end points, is painted black. The only other command is "LEFT", which means that the cursor should change its direction by 90 degrees counterclockwise. So, if the cursor is initially pointing straight down and it receives a single "LEFT" command, it will end up pointing straight to the right. Execute all the commands in order and return the resulting 20 x 20 pixel canvas as a String[] where character j of element i represents the pixel at (i, j). Black pixels should be represented as uppercase 'X' characters and blank pixels should be represented as '.' characters.
Definition
    
Class:
DrawLines
Method:
execute
Parameters:
String[]
Returns:
String[]
Method signature:
String[] execute(String[] commands)
(be sure your method is public)
    

Notes
-
The cursor only paints the canvas if it moves (see example 1).
Constraints
-
commands will contain between 1 and 50 elements, inclusive.
-
Each element of commands will be formatted as either "LEFT" or "FORWARD x" (quotes for clarity only), where x is an integer between 1 and 19, inclusive, with no extra leading zeros.
-
When executing the commands in order, the cursor will never leave the 20 x 20 pixel canvas.
Examples
0)

    
{"FORWARD 19", "LEFT", "FORWARD 19", "LEFT", "FORWARD 19", "LEFT", "FORWARD 19"}
Returns:
{"XXXXXXXXXXXXXXXXXXXX",
 "X..................X",
 "X..................X",
 "X..................X",
 "X..................X",
 "X..................X",
 "X..................X",
 "X..................X",
 "X..................X",
 "X..................X",
 "X..................X",
 "X..................X",
 "X..................X",
 "X..................X",
 "X..................X",
 "X..................X",
 "X..................X",
 "X..................X",
 "X..................X",
 "XXXXXXXXXXXXXXXXXXXX" }
This sequence of commands draws a 20 x 20 outline of a square. The cursor is initially at (0, 0) pointing straight down. It then travels to (0, 19) after the first FORWARD command, painting each pixel along its path with a '*'. It then rotates 90 degrees left, travels to (19, 19), rotates 90 degrees left, travels to (19, 0), rotates 90 degrees left, and finally travels back to (0, 0).
1)

    
{"LEFT", "LEFT", "LEFT", "LEFT", "LEFT", "LEFT", "LEFT", "LEFT"}
Returns:
{"....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "...................." }
The cursor spins round and round, but never actually paints any pixels. The result is an empty canvas.
2)

    
{"FORWARD 1"}
Returns:
{"X...................",
 "X...................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "....................",
 "...................." }
Going forward by one pixel creates a line that is 2 pixels long because both the start and end points are painted.
3)

    
{"LEFT", "FORWARD 19", "LEFT", "LEFT", "LEFT",
 "FORWARD 18", "LEFT", "LEFT", "LEFT", "FORWARD 17",
 "LEFT", "LEFT", "LEFT", "FORWARD 16", "LEFT",
 "LEFT", "LEFT", "FORWARD 15", "LEFT", "LEFT", "LEFT",
 "FORWARD 14", "LEFT", "LEFT", "LEFT", "FORWARD 13",
 "LEFT", "LEFT", "LEFT", "FORWARD 12", "LEFT", "LEFT",
 "LEFT", "FORWARD 11", "LEFT", "LEFT", "LEFT", "FORWARD 10",
 "LEFT", "LEFT", "LEFT", "FORWARD 9", "LEFT", "LEFT",
 "LEFT", "FORWARD 8", "LEFT", "LEFT", "LEFT", "FORWARD 7"}
Returns:
{"XXXXXXXXXXXXXXXXXXXX",
 "...................X",
 "..XXXXXXXXXXXXXXXX.X",
 "..X..............X.X",
 "..X.XXXXXXXXXXXX.X.X",
 "..X.X..........X.X.X",
 "..X.X.XXXXXXXX.X.X.X",
 "..X.X.X........X.X.X",
 "..X.X.X........X.X.X",
 "..X.X.X........X.X.X",
 "..X.X.X........X.X.X",
 "..X.X.X........X.X.X",
 "..X.X.X........X.X.X",
 "..X.X.X........X.X.X",
 "..X.X.XXXXXXXXXX.X.X",
 "..X.X............X.X",
 "..X.XXXXXXXXXXXXXX.X",
 "..X................X",
 "..XXXXXXXXXXXXXXXXXX",
 "...................." }

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.



emu瑙g瓟錛?/P>

public class DrawLines {
    
public String[] execute(String[] commands){
        
int[][] map = new int[20][20];
        
int x=0,y=0;
        
int[][] directions={{0,1},{1,0},{0,-1},{-1,0}};
        
int directionIndex = 0;
        
for(int i=0;i<commands.length;i++){
            String c 
= commands[i];
            
if(c.indexOf("LEFT")>-1){
                directionIndex 
= (directionIndex+1)%4 ;
            }
else{
                
int steps = Integer.parseInt(c.substring(8));
                map[x][y]
=1;
                
for(int j=0;j<steps;j++){
                    x
+=directions[directionIndex][0];
                    y
+=directions[directionIndex][1];
                    map[x][y]
=1;
                }

            }

        }

        String[] result
=new String[20];
        
for(int i=0;i<20;i++){
            result[i]
="";
            
for(int j=0;j<20;j++){
                result[i]
+=map[j][i]==1?"X":".";
            }

            System.out.println(result[i]);
        }

        
return result;
    }


    
public static void main(String[] args) {
        String[] s;
        s
= new String[]{"FORWARD 19""LEFT""FORWARD 19""LEFT""FORWARD 19""LEFT""FORWARD 19"};
        
new DrawLines().execute(s);
        System.out.println();
        s
= new String[]{"LEFT""LEFT""LEFT""LEFT""LEFT""LEFT""LEFT""LEFT"};
        
new DrawLines().execute(s);
        System.out.println();
        s
= new String[]{"FORWARD 1"};
        
new DrawLines().execute(s);
        System.out.println();
        s
= new String[]{"LEFT""FORWARD 19""LEFT""LEFT""LEFT",
     
"FORWARD 18""LEFT""LEFT""LEFT""FORWARD 17",
     
"LEFT""LEFT""LEFT""FORWARD 16""LEFT",
     
"LEFT""LEFT""FORWARD 15""LEFT""LEFT""LEFT",
     
"FORWARD 14""LEFT""LEFT""LEFT""FORWARD 13",
     
"LEFT""LEFT""LEFT""FORWARD 12""LEFT""LEFT",
     
"LEFT""FORWARD 11""LEFT""LEFT""LEFT""FORWARD 10",
     
"LEFT""LEFT""LEFT""FORWARD 9""LEFT""LEFT",
     
"LEFT""FORWARD 8""LEFT""LEFT""LEFT""FORWARD 7"}
;
        
new DrawLines().execute(s);
    }

}



鐑韓棰橈紝寰堜箙娌℃湁鍐檍ava浜嗭紝鏀逛簡鍗婂ぉ璇硶閿欒銆?img src ="http://www.tkk7.com/emu/aggbug/22085.html" width = "1" height = "1" />

emu 2005-12-01 10:37 鍙戣〃璇勮
]]>
SongRenamer (鍏ュ洿璧?50鍒嗙湡棰?http://www.tkk7.com/emu/articles/10997.htmlemuemuThu, 25 Aug 2005 03:08:00 GMThttp://www.tkk7.com/emu/articles/10997.htmlhttp://www.tkk7.com/emu/comments/10997.htmlhttp://www.tkk7.com/emu/articles/10997.html#Feedback3http://www.tkk7.com/emu/comments/commentRss/10997.htmlhttp://www.tkk7.com/emu/services/trackbacks/10997.html

Problem Statement

     You are given a collection of music files that have each been tagged with the artist, album, track number, and song title. However, the actual file names do not follow any standard format. Given a desired naming format, determine the proper names for all of the files in the collection. You are given four String[]s, artists, albums, tracks, and titles, which contain the artist, album, track number, and song title, respectively, for all the music files. Element i of each String[] corresponds to the ith file. You are given the desired file name format as a String, format. This String will contain only characters from "ABTS -()._" (quotes for clarity only). To determine a file name, replace all occurrences of 'A', 'B', 'T', and 'S' in format with the artist, album, track number, and song title, respectively. All other characters should remain untouched. For example, if format = "A - B - T) S", the artist is "The Beatles", the album is "Rubber Soul", the track number is "07", and the song title is "Michelle", the file should be named "The Beatles - Rubber Soul - 07) Michelle". Return a String[] containing the file names for all the songs in the collection. The ith element of the return String[] should correspond to the song represented by the ith elements of the four String[] parameters.

Definition

    
Class: SongRenamer
Method: rename
Parameters: String[], String[], String[], String[], String
Returns: String[]
Method signature: String[] rename(String[] artists, String[] albums, String[] tracks, String[] titles, String format)
(be sure your method is public)
    

Constraints

- artists, albums, tracks, and titles will each contain between 1 and 20 elements, inclusive. - artists, albums, tracks, and titles will each contain the same number of elements. - Each element of artists, albums, tracks, and titles will contain between 1 and 20 characters, inclusive. - Each element of artists, albums, tracks, and titles will contain only letters ('a'-'z', 'A'-'Z'), digits ('0'-'9'), and spaces. - format will contain between 1 and 10 characters, inclusive. - format will contain only characters from the String "ABTS -()._" (quotes for clarity only).

Examples

0)     
{"Marvin Gaye", "Marvin Gaye"}
{"Here My Dear", "Whats Going On"}
{"09", "7"}
{"Annas Song", "Right On"}
"A - B-T-S"
Returns: 
{"Marvin Gaye - Here My Dear-09-Annas Song",
 "Marvin Gaye - Whats Going On-7-Right On" }
1)     
{"Booker T and the MGs"}
{"McLemore Avenue"}
{"Number Two"}
{"Something"}
"T. S_B_(S)"
Returns: {"Number Two. Something_McLemore Avenue_(Something)" }
format can contain multiple instances of the same tag. Also, track numbers do not have to contain only digits.
2)     
{"The Beatles", "The Supremes", "YellowMatterCustard"}
{"A Hard Days Night", "A Bit Of Liverpool", "One Night In NYC"}
{"Twelve", "Siete", "7"}
{"You Cant Do That", "You Cant Do That", "You Cant Do That"}
"S (S) S"
Returns: 
{"You Cant Do That (You Cant Do That) You Cant Do That",
 "You Cant Do That (You Cant Do That) You Cant Do That",
 "You Cant Do That (You Cant Do That) You Cant Do That" }
3)     
{"  The Leading Spaces"}
{"  "}
{"Trailing Space  "}
{" s p a  c e s "}
"S._A_B(T)"
Returns: {" s p a  c e s ._  The Leading Spaces_  (Trailing Space  )" }
Preserve all spaces.
4)     
{"Ignored"}
{"Unnoticed"}
{"000"}
{"Uncredited"}
"()-(). "
Returns: {"()-(). " }
format doesn't necessarily have to contain any tags.

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.



emu 2005-08-25 11:08 鍙戣〃璇勮
]]>
Crop(鍏ュ洿璧?50鍒嗙湡棰?http://www.tkk7.com/emu/articles/10996.htmlemuemuThu, 25 Aug 2005 03:04:00 GMThttp://www.tkk7.com/emu/articles/10996.htmlhttp://www.tkk7.com/emu/comments/10996.htmlhttp://www.tkk7.com/emu/articles/10996.html#Feedback5http://www.tkk7.com/emu/comments/commentRss/10996.htmlhttp://www.tkk7.com/emu/services/trackbacks/10996.html

Problem Statement

     You are given a black and white image in a String[], image. Character j of element i (both 0-based indices) of image represents the pixel in row i, column j. 'X' characters represent black pixels and '.' characters represent white pixels. You are given a String[], crops, which contains a series of rectangular crop operations that are performed on the image. Cropping is an operation that trims an image so that only the specified area of the original image remains. Each element of crops is formatted as "r1 c1 r2 c2" (quotes for clarity only), where the upper left corner of the area to crop is at row r1, column c1, and the lower right corner is at row r2, column c2. The coordinates are inclusive. The crop operations are performed in the order that they appear in crops, and each one is performed on the most recent version of the image. The constraints will guarantee that all crop operations will be within the boundaries of the image. Return the final cropped image as a String[] in the same format as the original image String[].

Definition

    
Class: Crop
Method: crop
Parameters: String[], String[]
Returns: String[]
Method signature: String[] crop(String[] image, String[] crops)
(be sure your method is public)
    

Constraints

- image will contain between 1 and 50 elements, inclusive. - Each element of image will contain between 1 and 50 characters, inclusive. - Each element of image will contain exactly the same number of characters. - Each element of image will contain only '.' and uppercase 'X' characters. - crops will contain between 1 and 10 elements, inclusive. - Each element of crops will be formatted as described in the problem statement and no integers within crops will contain extra leading zeros. - Within each element of crops, r2 will be greater than or equal to r1 and c2 will be greater than or equal to c1. - crops will contain no operations that exceed the boundaries of the image at any time in the cropping process.

Examples

0)     
{".........",
 "X.XXXXXXX",
 "....X....",
 "........." }
{"1 0 2 8", "0 0 1 1"}
Returns: {"X.", ".." }
The first crop effectively removes the top and bottom rows of the image and results in:

X.XXXXXXX
....X....

The second crop is then performed relative to the new image:

X.
..
1)     
{"X.X.X.X.X.X.X.X",
 ".X.X.X.X.X.X.X."}
{"0 0 1 14", "0 0 1 14", "0 0 1 14"}
Returns: {"X.X.X.X.X.X.X.X", ".X.X.X.X.X.X.X." }
These crops don't affect the original image at all.
2)     
{".X..X.X.XX.",
 "..X..X...X.",
 "X......X..X",
 ".X....X...X",
 "..XXXX.X.X.",
 "XXX..XXX..X"}
{"0 0 0 0"}
Returns: {"." }
3)     
{".X..X.X.XX.",
 "..X..X...X.",
 "X......X..X",
 ".X....X...X",
 "..XXXX.X.X.",
 "XXX..XXX..X"}
{"1 0 5 9", "0 1 4 8", "0 0 3 5"}
Returns: {".X..X.", "......", "X....X", ".XXXX." }

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.



emu 2005-08-25 11:04 鍙戣〃璇勮
]]>
URLParser(鍏ュ洿璧?50鍒嗙湡棰?http://www.tkk7.com/emu/articles/10808.htmlemuemuTue, 23 Aug 2005 08:38:00 GMThttp://www.tkk7.com/emu/articles/10808.htmlhttp://www.tkk7.com/emu/comments/10808.htmlhttp://www.tkk7.com/emu/articles/10808.html#Feedback10http://www.tkk7.com/emu/comments/commentRss/10808.htmlhttp://www.tkk7.com/emu/services/trackbacks/10808.html
Problem Statement
????
When a web client (like a browser) requests a particular web page, it typically replaces certain characters with escape sequences. For instance, spaces are replaced with "%20". Your task is to reverse this, replacing every escape sequence in the input with the character it represents. Each escape sequence is formatted as "%XX" where XX is the ASCII value of the escaped character in hexadecimal.
Definition
????
Class:
URLParser
Method:
parse
Parameters:
String
Returns:
String
Method signature:
String parse(String url)
(be sure your method is public)
????

Constraints
-
url will contain between 1 and 50 characters, inclusive.
-
Each '%' in the input will be followed by a hexadecimal value between 20 (hex) and 7E (letters will be uppercase).
-
Each character in the input will have ASCII value between 32 and 126, inclusive.
Examples
0)

????
"http://www.%20%40%20%40%20.com/%25"
Returns: "http://www. @ @ .com/%"
"%20" is the escape sequence for ' ', while "%40" stands for '@' and "%25" stands for '%'.
1)

????
"%20%21%22%23%24%25%26%27%28"
Returns: " !\"#$%&'("

2)

????
"%48%65%6C%6C%6F%20%57%6F%72%6C%64%21"
Returns: "Hello World!"

3)

????
"%2525"
Returns: "%25"

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.



emu 2005-08-23 16:38 鍙戣〃璇勮
]]>
NewStation(鍏ュ洿璧?50鍒嗙湡棰?http://www.tkk7.com/emu/articles/10807.htmlemuemuTue, 23 Aug 2005 08:37:00 GMThttp://www.tkk7.com/emu/articles/10807.htmlhttp://www.tkk7.com/emu/comments/10807.htmlhttp://www.tkk7.com/emu/articles/10807.html#Feedback4http://www.tkk7.com/emu/comments/commentRss/10807.htmlhttp://www.tkk7.com/emu/services/trackbacks/10807.html
Problem Statement
????
You are given a String[], grid, representing a city where each character in grid is a single city block. Each block will contain a digit representing the relative population on that block. For example, a block containing the digit '6' will contain three times as many people as a block containing the digit '2'. You are also given a String[], stations, containing the locations of all the fire stations within the city. Each element of stations is formatted as "r c" (quotes for clarity only), where r and c represent the row and column, respectively, of the block on which a fire station is located. Character j of element i of grid represents the block at row i, column j. All indices are 0-based.

The city has received enough funds to build one additional fire station, and the mayor has decided that it is most important to minimize the average distance between a person and the closest fire station to that person. The metric used to determine the distance between two locations in the city is the Manhattan distance between the two blocks on which the locations are situated. The Manhattan distance between two blocks (r1, c1) and (r2, c2) is |r1-r2|+|c1-c2| (the vertical bars represent absolute value). Determine the block on which the new station should be built and return its row and column formatted as "r c" (quotes for clarity only). The return String should contain no extra leading zeros. If multiple blocks are equally optimal, return the one with the lowest row, and if multiple optimal blocks have the same lowest row, return the one among them with the lowest column. If adding an additional fire station would not reduce the average distance between a person and the closest fire station to that person, return the empty String ("").
Definition
????
Class:
NewStation
Method:
location
Parameters:
String[], String[]
Returns:
String
Method signature:
String location(String[] grid, String[] stations)
(be sure your method is public)
????

Constraints
-
grid will contain between 1 and 20 elements, inclusive.
-
Each element of grid will contain between 1 and 20 characters, inclusive.
-
Each element of grid will contain exactly the same number of characters.
-
Each element of grid will contain only digits ('0'-'9').
-
At least one character in grid will be non-zero.
-
stations will contain between 1 and 10 elements, inclusive.
-
Each element of stations will be formatted as "r c" (quotes for clarity only), where r and c are each integers between 0 and 19, inclusive, with no leading zeros.
-
Each element of stations will represent a location within the boundaries of grid.
Examples
0)

????
{"111",
 "111",
 "111"}
{"1 1"}
Returns: "0 1"
There's an existing station at (1, 1) and each block contains exactly the same number of people. Placing a new station at either (0, 1), (1, 0), (1, 2), or (2, 1) would minimize the average distance. (0, 1) is chosen since it has the lowest row. Adding the new station reduces the average distance from approximately 1.33 to 1.0. The distance from each block to the nearest station becomes:
101
101
212
1)

????
{"111",
 "111",
 "111"}
{"0 0", "0 1", "0 2",
 "1 0", "1 1", "1 2",
 "2 0", "2 1", "2 2"}
Returns: ""
There's a fire station on every block, so adding a new station would not reduce the average distance.
2)

????
{"2312",
 "0233"}
{"1 3"}
Returns: "0 1"
Placing a fire station at (0, 1) would make the average distance 0.625.
3)

????
{"2312",
 "0233"}
{"1 1", "1 1"}
Returns: "0 3"

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.



emu 2005-08-23 16:37 鍙戣〃璇勮
]]>
SalesFigures(鍏ュ洿璧?50鍒嗙湡棰?http://www.tkk7.com/emu/articles/10795.htmlemuemuTue, 23 Aug 2005 07:04:00 GMThttp://www.tkk7.com/emu/articles/10795.htmlhttp://www.tkk7.com/emu/comments/10795.htmlhttp://www.tkk7.com/emu/articles/10795.html#Feedback1http://www.tkk7.com/emu/comments/commentRss/10795.htmlhttp://www.tkk7.com/emu/services/trackbacks/10795.html
Problem Statement
????
A company stores sales data in a single, cumbersome file. Each line of the file represents one sale and is formatted as:
    CLIENT_ID CNT_1 PRODUCT_1 CNT_2 PRODUCT_2 ...
This indicates that CNT_1 units of PRODUCT_1 were sold to the client whose id is CLIENT_ID, and CNT_2 units of PRODUCT_2 and so on. You have been tasked with figuring out how many units of a particular product have been sold over time to a particular client. You will be given a String[] sales, a String, client, and a String, product. You are to return an int representing how many units of product were sold to client in sales.
Definition
????
Class:
SalesFigures
Method:
getCount
Parameters:
String[], String, String
Returns:
int
Method signature:
int getCount(String[] sales, String client, String product)
(be sure your method is public)
????

Constraints
-
sales will contain between 1 and 50 elements, inclusive.
-
Each element of sales will be formatted as described in the problem statement, with at least 1 product and at most 50 characters.
-
CLIENT_ID and each PRODUCT_* will contain between 1 and 10 uppercase letters ('A'-'Z'), inclusive.
-
Each CNT_* will represent an integer between 1 and 999, inclusive, with no leading zeros.
-
client will contain between 1 and 10 uppercase letters ('A'-'Z'), inclusive.
-
product will contain between 1 and 10 uppercase letters ('A'-'Z'), inclusive.
Examples
0)

????
{"BOB 1 SHOE",
 "JOHN 2 SHOE",
 "BOB 3 SHOE 1 HORSE"}
"BOB"
"SHOE"
Returns: 4

1)

????
{"MEG 1 TV 1 VCR 10 DVD 3 DVD",
 "HARRY 2 TV 6 DVD",
 "MEG 11 DVD",
 "MEG 2 TV",
 "HARRY 101 DVD"}
"MEG"
"DVD"
Returns: 24
Note that "DVD" occurs twice in the first element.
2)

????
{"GEORGE 999 PETS"}
"BOB"
"SHOE"
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.



emu 2005-08-23 15:04 鍙戣〃璇勮
]]>
SongFilter (鍏ュ洿璧?50鐪熼)http://www.tkk7.com/emu/articles/10781.htmlemuemuTue, 23 Aug 2005 03:47:00 GMThttp://www.tkk7.com/emu/articles/10781.htmlhttp://www.tkk7.com/emu/comments/10781.htmlhttp://www.tkk7.com/emu/articles/10781.html#Feedback9http://www.tkk7.com/emu/comments/commentRss/10781.htmlhttp://www.tkk7.com/emu/services/trackbacks/10781.html
Problem Statement
????
You have a collection of music files with names formatted as "genre-artist-album-song" (quotes for clarity only), where genre, artist, album, and song each consist of only lowercase letters ('a'-'z') and spaces (but no leading/trailing spaces). The collection is given in the String[] collection. You would like to filter the songs according to a set of criteria given in the String[] filterInfo. Each element of filterInfo is an equality check formatted as "field=value" (quotes for clarity only), where field is "genre", "artist", "album", or "song", and value consists of only lowercase letters ('a'-'z') and spaces (but no leading/trailing spaces). For a file to pass through the filter, it must satisfy every equality check in filterInfo. For example, if filterInfo = {"genre=country", "album=greatest hits"}, only songs from country greatest hits albums should be returned. Return a String[] containing all the files that meet the given criteria in the same relative order as they appear in collection.
Definition
????
Class:
SongFilter
Method:
filter
Parameters:
String[], String[]
Returns:
String[]
Method signature:
String[] filter(String[] collection, String[] filterInfo)
(be sure your method is public)
????

Constraints
-
collection will contain between 1 and 50 elements, inclusive.
-
Each element of collection will be formatted as described in the problem statement.
-
Each element of collection will contain between 7 and 50 characters, inclusive.
-
Each genre, artist, album, and song in collection will contain between 1 and 20 characters, inclusive.
-
collection will contain no duplicate elements.
-
filterInfo will contain between 1 and 4 elements, inclusive.
-
Each element of filterInfo will be formatted as described in the problem statement.
-
Each value in filterInfo will contain between 1 and 20 characters, inclusive.
Examples
0)

????
{"jazz-joe pass-virtuoso-cherokee",
 "rock-led zeppelin-ii-lemon song",
 "country-dwight yoakam-long way home-things change",
 "metal-iron maiden-powerslave-aces high",
 "pop-supremes-more hits-ask any girl",
 "rock-faith no more-angel dust-rv",
 "jazz-chuck mangione-feels so good-feels so good",
 "rock-van halen-ii-spanish fly"}
{"genre=rock", "album=ii"}
Returns: {"rock-led zeppelin-ii-lemon song", "rock-van halen-ii-spanish fly" }
This filter returns all the rock songs from albums with the title "ii".
1)

????
{"rock-jimi hendrix-axis bold as love-little wing",
 "rock-cars-cars-moving in stereo",
 "rock-jimi hendrix-electric ladyland-gypsy eyes",
 "blues-albert collins-ice pickin-ice pick",
 "rock-jimi hendrix-axis bold as love-bold as love",
 "rock-jimi  hendrix-axis bold as love-exp"}
{"artist=jimi hendrix", "album=axis bold as love"}
Returns:
{"rock-jimi hendrix-axis bold as love-little wing",
 "rock-jimi hendrix-axis bold as love-bold as love" }
This filter returns all the songs that are from the album "axis bold as love" by the artist "jimi hendrix". The last element in the collection is not returned because there are two spaces between "jimi" and "hendrix".
2)

????
{"rock-ozzy osbourne-blizzard of ozz-dee",
 "rock-marvelous three-hey album-let me go",
 "rock-cheap trick-in color-downed"}
{"genre=soul"}
Returns: { }
There is no soul music in this collection, so an empty String[] is returned.
3)

????
{"country-topcoder-the country album-twangy",
 "rock-topcoder-the rock album-rockin",
 "jazz-topcoder-the jazz album-jazzy",
 "soul-topcoder-the soul album-soulful",
 "metal-topcoder-the metal album-thrash"}
{"artist=topcoder", "genre=jazz", "album=the jazz album", "song=jazzy"}
Returns: {"jazz-topcoder-the jazz album-jazzy" }

4)

????
{"pop-jackson five-abc-the love you save",
 "rock-ac dc-powerage-riff raff"}
{"genre=pop", "genre=rock"}
Returns: { }
No single element of collection can represent more than one genre, so this filter returns an empty String[].
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.



emu 2005-08-23 11:47 鍙戣〃璇勮
]]>
ImageLayers錛堝叆鍥磋禌750鍒嗙湡棰橈級http://www.tkk7.com/emu/articles/10779.htmlemuemuTue, 23 Aug 2005 03:44:00 GMThttp://www.tkk7.com/emu/articles/10779.htmlhttp://www.tkk7.com/emu/comments/10779.htmlhttp://www.tkk7.com/emu/articles/10779.html#Feedback12http://www.tkk7.com/emu/comments/commentRss/10779.htmlhttp://www.tkk7.com/emu/services/trackbacks/10779.html

Problem Statement
????
An image editing application allows users to construct images containing multiple layers. When dealing with large images, however, it is sometimes necessary to limit the number of layers due to memory constraints. If certain layers will not be altered during an editing session, they can be merged together to reduce the total number of layers in memory. You are given a macro containing commands to open files and merge layers. Each time a file is opened, it is loaded into a new layer of the current image. Layers are numbered starting at 0 for the bottommost layer, 1 for the layer directly on top of the bottommost layer, etc... Whenever a new layer is created, it is positioned on top of the previous topmost layer. An open command is formatted as "OPEN filename" where filename is the name of the file to open. Consecutive layers can be merged using the merge command, which is formatted as "MERGE layer1-layer2", where layer1 and layer2 specify an inclusive range of layer numbers that exist in the current image. After multiple layers are merged, all the layers are renumbered according to the original specification. For example, if an image contains four layers (0, 1, 2, 3), and layers 1 and 2 are merged into a single layer, the final image will contain three layers numbered 0, 1, 2 from bottom to top, where layer 0 is the same as before, layer 1 was previously layers 1 and 2, and layer 2 was previously layer 3.

Given the String[] macro, perform all the operations in the macro in order and return the final state of the image layers as a String[]. The String[] should contain exactly the same number of elements as there are layers in the final image, and each element i should correspond to the ith layer. Each element of the String[] should be a single space delimited list of the filenames contained in that layer. The filenames should be sorted in alphabetical order within each layer.
Definition
????
Class:
ImageLayers
Method:
contents
Parameters:
String[]
Returns:
String[]
Method signature:
String[] contents(String[] macro)
(be sure your method is public)
????

Constraints
-
macro will contain between 1 and 50 elements, inclusive.
-
Each element of macro will be formatted as either "OPEN filename" or "MERGE layer1-layer2".
-
Each filename in macro will contain between 1 and 15 lowercase letters ('a'-'z'), inclusive.
-
Each layer1 and layer2 in macro will be integers between 0 and n-1, inclusive, with no leading zeros, where n is the number of layers that exist in the image immediately before the command is executed.
-
Within each element of macro that represents a merge command, layer1 will be less than layer2.
-
The first element of macro will be an OPEN command.
Examples
0)

????
{"OPEN background",
 "OPEN aone",
 "OPEN atwo",
 "OPEN foreground",
 "MERGE 0-2",
 "OPEN border"}
Returns: {"aone atwo background", "foreground", "border" }
After the first four commands in macro are executed, the layers are (from bottom to top):

0. background 1. aone 2. atwo 3. foreground

The merge command combines the bottom three layers into a single layer. There are now only two layers (from bottom to top):

0. background aone atwo 1. foreground

Finally, one last file is opened and placed in a new layer on top. The final return value contains the filenames within each layer sorted alphabetically:

0. aone atwo background 1. foreground 2. border
1)

????
{"OPEN sky",
 "OPEN clouds",
 "OPEN ground",
 "MERGE 0-1",
 "OPEN grass",
 "MERGE 0-2",
 "OPEN trees",
 "OPEN leaves",
 "OPEN birds",
 "MERGE 1-2",
 "MERGE 0-1"}
Returns: {"clouds grass ground leaves sky trees", "birds" }

2)

????
{"OPEN a", "OPEN b", "OPEN a", "OPEN a", "MERGE 0-3"}
Returns: {"a a a b" }

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.



emu 2005-08-23 11:44 鍙戣〃璇勮
]]>
DiskDefrag(璧涘墠妯℃嫙棰?http://www.tkk7.com/emu/articles/10196.htmlemuemuTue, 16 Aug 2005 01:30:00 GMThttp://www.tkk7.com/emu/articles/10196.htmlhttp://www.tkk7.com/emu/comments/10196.htmlhttp://www.tkk7.com/emu/articles/10196.html#Feedback16http://www.tkk7.com/emu/comments/commentRss/10196.htmlhttp://www.tkk7.com/emu/services/trackbacks/10196.htmlProblem Statement
????
When files are stored on a hard disk, they often become fragmented. This means that the file is not stored in sequential sectors on the disk. The first half of a file might be stored in sector 243, while the second half of a file might be far away in sector 105. The goal of defragmenting a hard drive is to arrange the files so that each file is stored in order on sequential sectors of the disk. Thus, if a file required 4 sectors of storage space, it would end up in sectors N, N+1, N+2, and N+3, for some N. Typically, this is done to increase the overall speed of the computer.  There are a number of programs that will defrag a hard disk as described above. However, many of them are painfully slow. You are trying to develop a new algorithm to defrag hard drives, but before you start, you would like to determine how fast you can defrag a very small drive without very many files on it. You will be given the locations of a number of files on a small hard disk, and are to determine the minimum number of sectors that must be moved before the entire drive is defragged. You have enough memory to hold two sectors worth of data at once, but that is all.  You will be given a String[], disk, each of whose elements represents a single file. Each element of disk will be formatted as a single-space delimited list of integers which represent the locations of the parts of the file, in order. Hence, the String, "4 9 6 59 41" represents a file stored in 5 sectors where the first part of the file is in sector 4 of the disk. One way to defrag this file would be to move the contents of sector 9 to sector 5, the contents of sector 59 to sector 7, and the contents of sector 41 to sector 8. By doing this, the file would be stored sequentially in sectors 4-8. You will also be given an int, size, representing the total number of sectors on the disk (sectors 0 through size-1, inclusive, may contain data). You are to return the smallest number of sectors that must be moved to defragment the whole disk. Keep in mind that you can not move data to a sector until any data being stored there is moved.
Definition
????
Class:
DiskDefrag
Method:
minMoves
Parameters:
String[], int
Returns:
int
Method signature:
int minMoves(String[] disk, int size)
(be sure your method is public)
????

Constraints
-
size will be between 10 and 100, inclusive.
-
disk will contain between 1 and 12 elements, inclusive.
-
Each element of disk will contain between 1 and 50 characters, inclusive.
-
Each element of disk will be a single-space delimited list of integers, without extraneous leading zeros.
-
Each integer in disk will be between 0 and size-1, inclusive.
-
No integer will be appear more than once in disk.
Examples
0)

????
{"3 4 5 6 8 9 10","17 16 15"}
20
Returns: 5
We can defrag the first file by moving the contents of sector 8 to sector 7, then 9 to 8, and finally 10 to 9. The second file can be defragged in a number of ways by moving the contents of two sectors, for a total of 5.
1)

????
{"1 2 3 5 4 6 7 8"}
10
Returns: 2
Here we can take advantage of the fact that we have enough memory to hold two sectors worth of data. First, load the contents of sectors 4 and 5 into memory. Now, simply write the data back in the reverse order.
2)

????
{"1 3 5 7","0 2 4 8","6 9"}
100
Returns: 7

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.



emu 2005-08-16 09:30 鍙戣〃璇勮
]]>
SimpleRouter(璧涘墠妯℃嫙棰?http://www.tkk7.com/emu/articles/10195.htmlemuemuTue, 16 Aug 2005 01:30:00 GMThttp://www.tkk7.com/emu/articles/10195.htmlhttp://www.tkk7.com/emu/comments/10195.htmlhttp://www.tkk7.com/emu/articles/10195.html#Feedback1http://www.tkk7.com/emu/comments/commentRss/10195.htmlhttp://www.tkk7.com/emu/services/trackbacks/10195.htmlProblem Statement
????
A router's job is to route packets of information to the correct computer. In addition, a router may throw out some packets, or handle the packets on its own. In this problem, you are to implement the software for a simple, rule-based router. Each rule in the router will take one of the following forms (quotes and angle brackets for clarity only):
"ACCEPT <IP_RANGE> <PORT_RANGE>"
"REJECT <IP_RANGE> <PORT_RANGE>"
"FORWARD <IP_RANGE> <PORT_RANGE> <DESTINATION> (<PORT>)"
Each <IP_RANGE> is a string of exactly four <NUMBER_RANGE>s, separated by periods, and each <PORT_RANGE> consists of a single <NUMBER_RANGE>. A <NUMBER_RANGE> can take one of three forms. It may be a single integer, a range of integers (in the form "<LOWER_LIMIT>-<UPPER_LIMIT>", where both limits are inclusive), or an asterisk. <DESTINATION> consists of exactly 4 integers, with 3 periods separating them (an IP address). If a FORWARD rule has a <PORT_RANGE> with only a single integer, then the <DESTINATION> may optionally be followed by a single integer, <PORT>.  Each rule tells the router what to do with a packet of information if that packet comes from an IP in the rule's <IP_RANGE> and to a port in the rule's <PORT_RANGE>. An IP is in the <IP_RANGE> if each <NUMBER_RANGE> in the <IP_RANGE> matches the corresponding number in the IP. A <NUMBER_RANGE> matches a number, N, if the <NUMBER_RANGE> is an asterisk, if it is a single number that is the same as N, or if it is a range and N falls within the range, inclusive. The rules for matching a <PORT_RANGE> are the same.  If a rule tells the router to forward the packet, then it should be forwarded to <DESTINATION>. If no <PORT> is specified, the packet should be forwarded to the same port it was received on. Otherwise, it should be forwarded to the specified port. If multiple rules apply to a packet, you should use the one that comes last in the input. If no rules apply, REJECT the packet.  You will be given a String[], rules, representing a number of rules that the router is to follow. You will also be given a String[], packets, each of whose elements represents a packet of data in the form "<SOURCE_IP> <PORT>" (<SOURCE_IP> is formatted the same as <DESTINATION>). You should return a String[] with one element per packet, specifying what to do with the packet with the same index in the input as the return. Each element of the return should be either "ACCEPT", "REJECT", or "<IP>:<PORT>", where <IP> and <PORT> represent the location to which the packet should be forwarded.
Definition
????
Class:
SimpleRouter
Method:
route
Parameters:
String[], String[]
Returns:
String[]
Method signature:
String[] route(String[] rules, String[] packets)
(be sure your method is public)
????

Notes
-
While the input may have extraneous leading zeros, your return should not.
Constraints
-
rules will contain between 1 and 50 elements, inclusive.
-
Each element of rules will be formatted as described in the problem statement.
-
packets will contain between 1 and 50 elements, inclusive.
-
Each element of packets will be formatted as described in the problem statement.
-
Each of the four numbers in an IP address, or a number range in an IP address will be between 0 and 255, inclusive.
-
Each port or number in a port range will be between 1 and 65535 inclusive.
-
In any <NUMBER_RANGE> with two numbers, <LOWER_LIMIT> will be less than or equal to <UPPER_LIMIT>.
Examples
0)

????
{"FORWARD 192.168.000.* 001-100 192.168.0.10",
 "FORWARD 192.168.0.1 80 10.10.95.184 8080",
 "ACCEPT 192.168.*.* 25",
 "REJECT 192.168.5.38 *"}
{"192.168.0.43 80",
 "00192.00168.000.001 00080",
 "192.168.0.1 110",
 "192.168.1.73 80",
 "192.168.1.73 25",
 "206.26.210.5 53",
 "192.168.5.38 25"
 }
Returns:
{ "192.168.0.10:80",
  "10.10.95.184:8080",
  "REJECT",
  "REJECT",
  "ACCEPT",
  "REJECT",
  "REJECT" }
Packet 0 matches rule 0, and gets forwarded according to that rule. Packet 1 matches both rules 0 and 1, so rule 1 is applied. Packets 2, 3, and 5 don't match any rules, so they are rejected. Packet 4 matches rule 2, and is therefore accepted. Packet 6 matches rules 2 and 3, so it gets rejected (rule 3 is applied).
1)

????
{"FORWARD *.*.*.* * 192.168.0.1"}
{"213.148.161.82 9484",
 "172.230.108.145 16627",
 "122.141.122.130 46874",
 "241.145.145.77 26390",
 "139.97.106.125 35305",
 "244.131.151.77 26390"}
Returns:
{ "192.168.0.1:9484",
  "192.168.0.1:16627",
  "192.168.0.1:46874",
  "192.168.0.1:26390",
  "192.168.0.1:35305",
  "192.168.0.1:26390" }

2)

????
{"REJECT *.20-252.114-157.36-91 13171-54085",
 "ACCEPT *.*.73-180.* *",
 "FORWARD 55.63.173.239 * 168.154.33.25",
 "REJECT *.72-73.*.48-191 *",
 "REJECT 20.51.*.* 4579",
 "ACCEPT 70-166.*.*.86-182 *",
 "REJECT 88-190.*.119-157.* 3316-27844",
 "FORWARD *.52-221.134-250.66-207 * 116.94.120.82"}
{"203.11.104.45 44072",
 "154.92.128.87 30085",
 "20.51.68.55 4579",
 "177.73.138.69 14319",
 "112.65.145.82 26287",
 "55.63.173.239 45899"}
Returns:
{ "ACCEPT",
  "ACCEPT",
  "REJECT",
  "116.94.120.82:14319",
  "116.94.120.82:26287",
  "168.154.33.25:45899" }

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.



emu 2005-08-16 09:30 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 欧洲精品99毛片免费高清观看| 男女猛烈无遮掩视频免费软件| 亚洲免费视频在线观看| 中文字幕精品亚洲无线码一区 | 亚洲国产精品特色大片观看完整版| 理论秋霞在线看免费| 亚洲国产小视频精品久久久三级| 又硬又粗又长又爽免费看| 国产亚洲一区二区三区在线不卡 | 国产成人AV片无码免费| 亚洲av无码无在线观看红杏| 日韩精品免费在线视频| 亚洲午夜久久久久久尤物| 成人性生交视频免费观看| 噜噜噜亚洲色成人网站| 亚洲国产a级视频| 美女视频黄的免费视频网页| 亚洲理论片在线观看| 四虎影院在线免费播放| j8又粗又长又硬又爽免费视频| 久久夜色精品国产亚洲| 99无码人妻一区二区三区免费| 亚洲av无码有乱码在线观看| 亚洲国产精品无码久久久久久曰| 国产一区二区免费视频| 国产午夜亚洲精品| 亚洲国产综合人成综合网站| 免费A级毛片av无码| 亚洲欧美中文日韩视频| 狠狠综合久久综合88亚洲| 1000部夫妻午夜免费| 老司机亚洲精品影院在线观看| 亚洲综合另类小说色区色噜噜| 91久久青青草原线免费| 久久久亚洲精华液精华液精华液 | 四虎影院永久免费观看| 无码人妻一区二区三区免费看| 亚洲精品国产国语| 亚洲人成77777在线播放网站| 亚洲成在人线aⅴ免费毛片| 人成免费在线视频|