锘??xml version="1.0" encoding="utf-8" standalone="yes"?>精品久久久久久无码中文字幕一区,亚洲精品综合久久,9191精品国产免费久久http://www.shnenglu.com/ArcTan/category/19467.htmldfszh-cnSun, 22 Jul 2012 06:56:09 GMTSun, 22 Jul 2012 06:56:09 GMT60SRM 500 DIV2 500PT錛堟ā鎷燂級http://www.shnenglu.com/ArcTan/articles/184581.htmlwangswangsSun, 22 Jul 2012 02:10:00 GMThttp://www.shnenglu.com/ArcTan/articles/184581.htmlhttp://www.shnenglu.com/ArcTan/comments/184581.htmlhttp://www.shnenglu.com/ArcTan/articles/184581.html#Feedback0http://www.shnenglu.com/ArcTan/comments/commentRss/184581.htmlhttp://www.shnenglu.com/ArcTan/services/trackbacks/184581.html

Problem Statement

     NOTE: This problem statement contains images that may not display properly if viewed outside of the applet.

We had a rectangular grid that consisted of W x H square cells. We placed a robot on one of the cells. The robot then followed the rules given below.
  • Initially, the robot is facing east.
  • The robot moves in steps. In each step it moves to the adjacent cell in the direction it currently faces.
  • The robot may not leave the grid.
  • The robot may not visit the same cell twice. (This also means that it may not reenter the starting cell.)
  • If a step forward does not cause the robot to break the above rules, the robot takes the step.
  • Otherwise, the robot rotates 90 degrees to the left (counter-clockwise) and checks whether a step forward still breaks the above rules. If not, the robot takes the step and continues executing this program (still rotated in the new direction).
  • If the rotation left did not help, the robot terminates the execution of this program.
  • We can also terminate the execution of the program manually, at any moment.
For example, the following seven images show a series of moves made by the robot in a 12 x 11 board:



We forgot the dimensions of the grid and the original (x,y) coordinates of the cell on which the robot was originally placed, but we do remember its movement. You are given a vector <int> moves. This sequence of positive integers shall be interpreted as follows: The robot performed moves[0] steps eastwards, turned left, performed moves[1] steps northwards, turned left, and so on. After performing the last sequence of steps, the robot stopped. (Either it detected that it should terminate, or we stopped it manually.) We are not sure if the sequence of moves is valid. If the sequence of moves is impossible, return -1. Else, return the minimum area of a grid in which the sequence of moves is possible. (I.e., the return value is the smallest possible value of the product of W and H.).

Definition

    
Class: RotatingBot
Method: minArea
Parameters: vector <int>
Returns: int
Method signature: int minArea(vector <int> moves)
(be sure your method is public)
    

Constraints

- moves will contain between 1 and 50 elements, inclusive.
- Each element of moves will be between 1 and 50, inclusive.

Examples

0)
    
{15}
Returns: 16
The smallest valid board is a 16x1 board, with the robot starting on the west end of the board.
1)
    
{3,10}
Returns: 44
The smallest solution is to place the robot into the southwest corner of a 4 x 11 board.
2)
    
{1,1,1,1}
Returns: -1
This sequence of moves is not possible because the robot would return to its initial location which is forbidden.
3)
    
{9,5,11,10,11,4,10}
Returns: 132
These moves match the image from the problem statement.
4)
    
{12,1,27,14,27,12,26,11,25,10,24,9,23,8,22,7,21,6,20,5,19,4,18,3,17,2,16,1,15}
Returns: 420

5)
    
{8,6,6,1}
Returns: -1

6)
    
{8,6,6}
Returns: 63

7)
    
{5,4,5,3,3}
Returns: 30

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.



妯℃嫙棰樼洰錛岀洿鎺ユ寜鐓х粰瀹氬簭鍒楅亶鍘嗭紝濡傛灉閬囧埌涓嶅悎娉曠殑鎯呭喌return -1銆傝瀹氬洓涓柟鍚戯紝mw,me,mn,ms錛屼笢鍖楄タ鍗楋紝鍒濆涓轟笂涓嬬晫銆傜劧鍚庝緷嬈℃壘鍒拌寖鍥淬?br />鍒濆鐐?100,100)銆?br />鏈鍚庣殑闈㈢Н涓?me-mw+1)*(ms-mn+1)

娌℃湁鑰冭檻瀹屽叏鍟婏紝鎬濈淮榪樻槸涓嶄弗璋ㄤ笉瀹屾暣錛屽氨WA浜嗕竴緇勬暟鎹紝鏄ㄦ櫄鍋氬氨鎮插墽浜嗭紒錛侊紒錛?br />鎴戞槸寮辮彍錛岀戶緇姫鍔涳紒

涓嶉敊鐨勬ā鎷熼鐩紝闇瑕佽冭檻鐨勪笢瑗垮緢澶氾紒
#include <cstdio>
#include 
<cstdlib>
#include 
<cstring>
#include 
<cmath>
#include 
<ctime>
#include 
<cassert>
#include 
<iostream>
#include 
<sstream>
#include 
<fstream>
#include 
<map>
#include 
<set>
#include 
<vector>
#include 
<queue>
#include 
<algorithm>
#define min(x,y) (x<y?x:y)
#define max(x,y) (x>y?x:y)
#define swap(t,x,y) (t=x,x=y,y=t)
#define clr(list) memset(list,0,sizeof(list))

using namespace std;
bool maps[205][205];
int go[4][2]={{1,0},{0,-1},{-1,0},{0,1}};
class RotatingBot{
public:
    
int minArea(vector <int> moves){
        
int n=moves.size();
        
int me=1000,mw=0,mn=0,ms=1000;
        
int tmp;
        
int dir;
        
int x,y,xx,yy;
        clr(maps);
        maps[
100][100]=1;
        x
=100,y=100,dir=0;
        
for (int i=0;i<n ;i++)
        {
            tmp
=moves[i];
            
for (int j=0;j<tmp;j++)
            {
                xx
=x+go[dir][0];yy=y+go[dir][1];
                
if (maps[xx][yy] || (xx<mw || xx>me || yy<mn || yy>ms))
                    
return -1;
                
else
                {
                    maps[xx][yy]
=1;
                    x
=xx;y=yy;
                }
            }
            xx
=x+go[dir][0];yy=y+go[dir][1];
            
if (!maps[xx][yy])
            {
                
if (dir==0)
                    
if (me==1000)
                        me
=x;
                    
else
                        
if (x<me && i<n-1)
                            
return -1;
                
if (dir==1)
                    
if (mn==0)
                        mn
=y;
                    
else if (y>mn && i<n-1)
                        
return -1;
                
if (dir==2)       //榪欓噷WA浜唗esting 5 & 6
                    
if (mw==0 && x<=100)
                        mw
=x;
                    
else
                        
if (x>mw && i<n-1)
                            
return -1;
                
if (dir==3)            //鏈鍚庢牻鍦ㄨ繖閲屼簡
                    
if (ms==1000 && y>=100)  
                        ms
=y;
                    
else if ((y<ms || y<100&& i<n-1)
                        
return -1;
            }
            dir
=(dir+1% 4;
        }
     
//   return mw;
        if (mw==0)
            mw
=100;
        
if (mn==0)
            mn
=100;
        
if (ms==1000)
            ms
=100;
        
return (me-mw+1)*(ms-mn+1);
    }
};



wangs 2012-07-22 10:10 鍙戣〃璇勮
]]>
SRM550 DIV2 250PT錛堝瓧絎︿覆姘撮錛?/title><link>http://www.shnenglu.com/ArcTan/articles/184580.html</link><dc:creator>wangs</dc:creator><author>wangs</author><pubDate>Sun, 22 Jul 2012 02:02:00 GMT</pubDate><guid>http://www.shnenglu.com/ArcTan/articles/184580.html</guid><wfw:comment>http://www.shnenglu.com/ArcTan/comments/184580.html</wfw:comment><comments>http://www.shnenglu.com/ArcTan/articles/184580.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/ArcTan/comments/commentRss/184580.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/ArcTan/services/trackbacks/184580.html</trackback:ping><description><![CDATA[<div> <table> <tbody><tr> <td colspan="2"> <h3> Problem Statement </h3> </td> </tr> <tr> <td>      </td> <td> We have a string <strong>originalWord</strong>. Each character of <strong>originalWord</strong> is either 'a' or 'b'. Timmy claims that he can convert it to <strong>finalWord</strong> using <em>exactly</em> <strong>k</strong> moves. In each move, he can either change a single 'a' to a 'b', or change a single 'b' to an 'a'.<br /><br />You are given the strings <strong>originalWord</strong> and <strong>finalWord</strong>, and the int <strong>k</strong>. Determine whether Timmy may be telling the truth. If there is a possible sequence of exactly <strong>k</strong> moves that will turn <strong>originalWord</strong> into <strong>finalWord</strong>, return "POSSIBLE" (quotes for clarity). Otherwise, return "IMPOSSIBLE". </td> </tr> <tr> <td colspan="2"> <h3> Definition </h3> </td> </tr> <tr> <td>      </td> <td> <table> <tbody><tr> <td> Class: </td> <td> EasyConversionMachine </td> </tr> <tr> <td> Method: </td> <td> isItPossible </td> </tr> <tr> <td> Parameters: </td> <td> string, string, int </td> </tr> <tr> <td> Returns: </td> <td> string </td> </tr> <tr> <td> Method signature: </td> <td> string isItPossible(string originalWord, string finalWord, int k) </td> </tr> <tr> <td colspan="2"> (be sure your method is public) </td> </tr> </tbody></table> </td> </tr> <tr> <td>      </td> </tr> <tr> <td> <br /></td> </tr> <tr> <td colspan="2"> <h3> Notes </h3> </td> </tr> <tr> <td valign="top" align="center"> - </td> <td> Timmy may change the same letter multiple times. Each time counts as a different move. </td> </tr> <tr> <td colspan="2"> <h3> Constraints </h3> </td> </tr> <tr> <td valign="top" align="center"> - </td> <td> <strong>originalWord</strong> will contain between 1 and 50 characters, inclusive. </td> </tr> <tr> <td valign="top" align="center"> - </td> <td> <strong>finalWord</strong> and <strong>originalWord</strong> will contain the same number of characters. </td> </tr> <tr> <td valign="top" align="center"> - </td> <td> Each character in <strong>originalWord</strong> and <strong>finalWord</strong> will be 'a' or 'b'. </td> </tr> <tr> <td valign="top" align="center"> - </td> <td> <strong>k</strong> will be between 1 and 100, inclusive. </td> </tr> <tr> <td colspan="2"> <h3> Examples </h3> </td> </tr> <tr> <td nowrap="true" align="center"> 0) </td> <td> <br /></td> </tr> <tr> <td>      </td> <td> <table> <tbody><tr> <td> <table> <tbody><tr> <td> <pre>"aababba"</pre> </td> </tr> <tr> <td> <pre>"bbbbbbb"</pre> </td> </tr> <tr> <td> <pre>2</pre> </td> </tr> </tbody></table> </td> </tr> <tr> <td> <pre>Returns: "IMPOSSIBLE"</pre> </td> </tr> <tr> <td> <table> <tbody><tr> <td colspan="2"> It is not possible to reach <strong>finalWord</strong> in fewer than 4 moves. </td> </tr> </tbody></table> </td> </tr> </tbody></table> </td> </tr> <tr> <td nowrap="true" align="center"> 1) </td> <td> <br /></td> </tr> <tr> <td>      </td> <td> <table> <tbody><tr> <td> <table> <tbody><tr> <td> <pre>"aabb"</pre> </td> </tr> <tr> <td> <pre>"aabb"</pre> </td> </tr> <tr> <td> <pre>1</pre> </td> </tr> </tbody></table> </td> </tr> <tr> <td> <pre>Returns: "IMPOSSIBLE"</pre> </td> </tr> <tr> <td> <table> <tbody><tr> <td colspan="2"> The number of moves must be exactly <strong>k</strong>=1. </td> </tr> </tbody></table> </td> </tr> </tbody></table> </td> </tr> <tr> <td nowrap="true" align="center"> 2) </td> <td> <br /></td> </tr> <tr> <td>      </td> <td> <table> <tbody><tr> <td> <table> <tbody><tr> <td> <pre>"aaaaabaa"</pre> </td> </tr> <tr> <td> <pre>"bbbbbabb"</pre> </td> </tr> <tr> <td> <pre>8</pre> </td> </tr> </tbody></table> </td> </tr> <tr> <td> <pre>Returns: "POSSIBLE"</pre> </td> </tr> <tr> <td> <table> <tbody><tr> <td colspan="2"> Use each move to change each of the letters once. </td> </tr> </tbody></table> </td> </tr> </tbody></table> </td> </tr> <tr> <td nowrap="true" align="center"> 3) </td> <td> <br /></td> </tr> <tr> <td>      </td> <td> <table> <tbody><tr> <td> <table> <tbody><tr> <td> <pre>"aaa"</pre> </td> </tr> <tr> <td> <pre>"bab"</pre> </td> </tr> <tr> <td> <pre>4</pre> </td> </tr> </tbody></table> </td> </tr> <tr> <td> <pre>Returns: "POSSIBLE"</pre> </td> </tr> <tr> <td> <table> <tbody><tr> <td colspan="2"> The following sequence of 4 moves does the job:<br />aaa -> baa -> bab -> aab -> bab </td> </tr> </tbody></table> </td> </tr> </tbody></table> </td> </tr> <tr> <td nowrap="true" align="center"> 4) </td> <td> <br /></td> </tr> <tr> <td>      </td> <td> <table> <tbody><tr> <td> <table> <tbody><tr> <td> <pre>"aababbabaa"</pre> </td> </tr> <tr> <td> <pre>"abbbbaabab"</pre> </td> </tr> <tr> <td> <pre>9</pre> </td> </tr> </tbody></table> </td> </tr> <tr> <td> <pre>Returns: "IMPOSSIBLE"</pre> </td> </tr> <tr> <td> <table> <tbody><tr> <td colspan="2"> <br /></td> </tr> </tbody></table> </td> </tr> </tbody></table> </td> </tr> </tbody></table> <p> 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 /></p><p><br /></p><p>瀛楃涓叉按棰橈紒</p><p>249.23PT錛侊紒錛?/p><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">cstdio</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">cstdlib</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">cstring</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">cmath</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">ctime</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">cassert</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">iostream</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">sstream</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">fstream</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">map</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #0000FF; ">set</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">vector</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">queue</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">algorithm</span><span style="color: #000000; ">></span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">#define</span><span style="color: #000000; "> min(x,y) (x<y?x:y)</span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">#define</span><span style="color: #000000; "> max(x,y) (x>y?x:y)</span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">#define</span><span style="color: #000000; "> swap(t,x,y) (t=x,x=y,y=t)</span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">#define</span><span style="color: #000000; "> clr(list) memset(list,0,sizeof(list))</span><span style="color: #000000; "><br /><br /></span><span style="color: #0000FF; ">using</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">namespace</span><span style="color: #000000; "> std;<br /><br /></span><span style="color: #0000FF; ">class</span><span style="color: #000000; "> EasyConversionMachine{<br /></span><span style="color: #0000FF; ">public</span><span style="color: #000000; ">:<br />    </span><span style="color: #0000FF; ">string</span><span style="color: #000000; "> isItPossible(</span><span style="color: #0000FF; ">string</span><span style="color: #000000; "> originalWord, </span><span style="color: #0000FF; ">string</span><span style="color: #000000; "> finalWord, </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> k)<br />    {<br />        </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> n</span><span style="color: #000000; ">=</span><span style="color: #000000; ">originalWord.size();<br />        </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> tot</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br />        </span><span style="color: #0000FF; ">for</span><span style="color: #000000; "> (</span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> i</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;i</span><span style="color: #000000; "><</span><span style="color: #000000; ">n;i</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)<br />            </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (originalWord[i]</span><span style="color: #000000; ">!=</span><span style="color: #000000; ">finalWord[i])<br />                tot</span><span style="color: #000000; ">++</span><span style="color: #000000; ">;<br />        </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (tot</span><span style="color: #000000; "><=</span><span style="color: #000000; ">k </span><span style="color: #000000; ">&&</span><span style="color: #000000; "> (k</span><span style="color: #000000; ">-</span><span style="color: #000000; ">tot)</span><span style="color: #000000; ">%</span><span style="color: #000000; ">2</span><span style="color: #000000; ">==</span><span style="color: #000000; ">0</span><span style="color: #000000; ">) //鍌誨弶錛岃繖閲屽垰鍒氬紑濮嬫悶鍙嶄簡錛宼esting WA浜嗕竴嬈?br />            </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">"</span><span style="color: #000000; ">POSSIBLE</span><span style="color: #000000; ">"</span><span style="color: #000000; ">;<br />        </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">"</span><span style="color: #000000; ">IMPOSSIBLE</span><span style="color: #000000; ">"</span><span style="color: #000000; ">;<br />    }<br />};</span></div> </div><img src ="http://www.shnenglu.com/ArcTan/aggbug/184580.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/ArcTan/" target="_blank">wangs</a> 2012-07-22 10:02 <a href="http://www.shnenglu.com/ArcTan/articles/184580.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>SRM 150 DIV 2 1000pt錛堟ā鎷燂級http://www.shnenglu.com/ArcTan/articles/183611.htmlwangswangsSun, 15 Jul 2012 14:01:00 GMThttp://www.shnenglu.com/ArcTan/articles/183611.htmlhttp://www.shnenglu.com/ArcTan/comments/183611.htmlhttp://www.shnenglu.com/ArcTan/articles/183611.html#Feedback0http://www.shnenglu.com/ArcTan/comments/commentRss/183611.htmlhttp://www.shnenglu.com/ArcTan/services/trackbacks/183611.html

Problem Statement

    

You are given a rectangular map in which each space is marked with one of three characters: '.' (open), 'B' (a brick), or '#' (an indestructible block). Walls made of indestructible blocks surround the field on all sides, but are not shown on the map. A ball is bouncing around this map, destroying bricks, and your task is determine how long it takes the ball to destroy all the bricks.

The top left space of the map is always open, and this is where the ball begins. More specifically, the ball begins at time 0 in the middle of the top edge of this space (see the diagram in Example 0). The ball is traveling diagonally down and to the right at a speed of half a meter per second vertically, and half a meter per second horizontally. Each space is 1 meter square, so the ball crosses half a space vertically and half a space horizontally each second.

Whenever the ball strikes the edge of an obstacle--either a brick or an indestructible block--it bounces off at an angle perpendicular to its incoming path. The ball will never hit two obstacles simultaneously. Whenever the ball bounces off a brick, the brick is destroyed and removed from the map.

Your method should return the time at which the last brick is destroyed. If one or more bricks will never be destroyed, return -1.

Definition

    
Class: BrickByBrick
Method: timeToClear
Parameters: vector <string>
Returns: int
Method signature: int timeToClear(vector <string> map)
(be sure your method is public)
    

Constraints

- map contains between 1 and 15 elements, inclusive.
- All elements of map contain the same number of characters (between 1 and 15, inclusive).
- All elements of map contain only the characters '.', 'B', and '#'.
- The top left corner of map (that is, the first character of the first element) is '.'.
- map contains at least one 'B'.

Examples

0)
    
{ ".B",   "BB" }
Returns: 6
The following diagram illustrates the path of the ball.
     __0________     | / \ |     |     |/   \|     |     3  .  1  B  |     |\   /|\    |     | \ / | \   |     |--2--|--6--|     |     |     |     |     |     |     |  B  |  B  |     |     |     |     |_____|_____|
The ball begins at point 0, traveling down and to the right. It bounces off the first brick at time 1, and off the second brick at time 2. At time 3, it bounces off the left wall, and at time 4 it bounces off the upper wall at the same place it started. At time 6, the ball destroys the third and final brick, so the method returns 6.
1)
    
{ ".BB",   "BBB",   "BBB" }
Returns: -1
The ball will never hit the brick in the bottom right corner.
2)
    
{ "......B",   "###.###",   "B.....B" }
Returns: 35

3)
    
{ "..BBB...",   ".#BB..#.",   "B.#B.B..",   "B.B.....",   "##.B.B#.",   "#BB.#.B.",   "B..B.BB.",   "#..BB..B",   ".B....#." }
Returns: -1

4)
    
{ ".BB..BBB.B...",   "B.B...B..BB..",   "#B...B#B.....",   "B#B.B##...##B",   "BB.B#.B##B.B#",   "B.B#.BBB.BB#B",   "B#BBB##.#B#B.",   "B#BB.BBB#BB.#" }
Returns: 3912

5)
    
{ ".BBBBBBBBBBBBBB",   "##############B",   "BBBBBBBBBBBBBBB",   "B##############",   "BBBBBBBBBBBBBBB",   "##############B",   "BBBBBBBBBBBBBBB",   "B##############",   "BBBBBBBBBBBBBBB",   "##############B",   "BBBBBBBBBBBBBBB",   "B##############",   "BBBBBBBBBBBBBBB",   "##############B",   "BBBBBBBBBBBBBBB" }
Returns: 31753

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.




棰樻剰錛氬氨鍍忔槸閭d釜鍟ユ父鎴忥紝鐪嬩簡閭d釜鍥懼氨鎸哄ソ鐞嗚В鐨勪簡銆?br />         娉ㄦ剰鏂瑰悜鍙樻崲銆?br /> 
鍐欎簡濂戒箙濂戒箙鍟婏紝
404PT錛?br />
#include<stdio.h>
#include
<fstream>
#include
<string>
#include
<vector>
#include
<algorithm>
using namespace std;

class BrickByBrick
{
public:
    
int timeToClear(vector <string> map)
    {
        
int time=0;
        
int bricks=0;
        
int impactTime=0;

        
float x,y,dirX,dirY,newX,newY;

        
for (int i=0; i<map.size(); i++)
        {
            map[i].insert(
0,sizeof(char),'#');
            map[i].push_back(
'#');
        }

        
string s;
        
for (int i=0; i<map[0].length(); i++)
            s.push_back(
'#');

        map.insert(map.begin(),s);
        map.push_back(s);


        
for (int i=0; i<map.size(); i++)
            bricks
+=count(map[i].begin(),map[i].end(),'B');

        x
=1.5;
        y
=1;
        dirX
=dirY=0.5;

        
while (bricks && impactTime <1000)
        {
            impactTime
++;
            x
+=dirX;
            y
+=dirY;

            
if (dirX==0.5 && dirY==0.5)
            {
                
if ((int)x==x)
                {
                    newX
=(int)x;
                    newY
=(int)y;
                }
                
else if ((int)y==y)
                {
                    newX
=(int)x;
                    newY
=(int)y;
                }
            }
            
if (dirX==-0.5 && dirY==-0.5)
            {
                
if ((int)x==x)
                {
                    newX
=(int)x-1;
                    newY
=(int)y;
                }
                
else if ((int)y==y)
                {
                    newX
=(int)x;
                    newY
=(int)y-1;
                }
            }
            
if (dirX==-0.5 && dirY==0.5)
            {
                
if ((int)x==x)
                {
                    newX
=(int)x-1;
                    newY
=(int)y;
                }
                
else if ((int)y==y)
                {
                    newX
=(int)x;
                    newY
=(int)y;
                }
            }
            
if (dirX==0.5 && dirY==-0.5)
            {
                
if ((int)x==x)
                {
                    newX
=(int)x;
                    newY
=(int)y;
                }
                
else if ((int)y==y)
                {
                    newX
=(int)x;
                    newY
=(int)y-1;
                }
            }
            
if (map[newY][newX]!='.')
            {
                
if ((int)x==x)
                {
                    
if (dirX==0.5 && dirY==0.5)
                    {
                        dirX
=-0.5;
                        dirY
=0.5;
                    }
                    
else if (dirX==-0.5 && dirY==-0.5)
                    {
                        dirX
=0.5;
                        dirY
=-0.5;
                    }
                    
else if (dirX==-0.5 && dirY==0.5)
                    {
                        dirX
=0.5;
                        dirY
=0.5;
                    }
                    
else if (dirX==0.5 && dirY==-0.5)
                    {
                        dirX
=-0.5;
                        dirY
=-0.5;
                    }
                }
                
if ((int)y==y)
                {
                    
if (dirX==0.5 && dirY==0.5)
                    {
                        dirX
=0.5;
                        dirY
=-0.5;
                    }
                    
else if (dirX==0.5 && dirY==-0.5)
                    {
                        dirX
=0.5;
                        dirY
=0.5;
                    }
                    
else if (dirX==-0.5 && dirY==0.5)
                    {
                        dirX
=-0.5;
                        dirY
=-0.5;
                    }
                    
else if (dirX==-0.5 && dirY==-0.5)
                    {
                        dirX
=-0.5;
                        dirY
=0.5;
                    }
                }
            }
            
if (map[newY][newX]=='B')
            {
                map[newY][newX]
='.';
                time
+=impactTime;
                impactTime
=0;
                bricks
--;
            }
        }
        
if (impactTime==1000)
            
return -1;
        
return time;
    }
};


 

wangs 2012-07-15 22:01 鍙戣〃璇勮
]]>
SRM 150 DIV 2 500pt錛坱hinking && 鏁拌錛?/title><link>http://www.shnenglu.com/ArcTan/articles/183609.html</link><dc:creator>wangs</dc:creator><author>wangs</author><pubDate>Sun, 15 Jul 2012 13:54:00 GMT</pubDate><guid>http://www.shnenglu.com/ArcTan/articles/183609.html</guid><wfw:comment>http://www.shnenglu.com/ArcTan/comments/183609.html</wfw:comment><comments>http://www.shnenglu.com/ArcTan/articles/183609.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/ArcTan/comments/commentRss/183609.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/ArcTan/services/trackbacks/183609.html</trackback:ping><description><![CDATA[<div> <table> <tbody><tr> <td colspan="2"> <h3> Problem Statement </h3> </td> </tr> <tr> <td>      </td> <td> <p> The digits 3 and 9 share an interesting property. If you take any multiple of 3 and sum its digits, you get another multiple of 3. For example, 118*3 = 354 and 3+5+4 = 12, which is a multiple of 3. Similarly, if you take any multiple of 9 and sum its digits, you get another multiple of 9. For example, 75*9 = 675 and 6+7+5 = 18, which is a multiple of 9. Call any digit for which this property holds <em>interesting</em>, except for 0 and 1, for which the property holds trivially. </p> <p> A digit that is interesting in one base is not necessarily interesting in another base. For example, 3 is interesting in base 10 but uninteresting in base 5. Given an int <strong>base</strong>, your task is to return all the interesting digits for that base in increasing order. To determine whether a particular digit is interesting or not, you need not consider <em>all</em> multiples of the digit. You can be certain that, if the property holds for all multiples of the digit with fewer than four digits, then it also holds for multiples with more digits. For example, in base 10, you would not need to consider any multiples greater than 999. </p> </td> </tr> <tr> <td colspan="2"> <h3> Definition </h3> </td> </tr> <tr> <td>      </td> <td> <table> <tbody><tr> <td> Class: </td> <td> InterestingDigits </td> </tr> <tr> <td> Method: </td> <td> digits </td> </tr> <tr> <td> Parameters: </td> <td> int </td> </tr> <tr> <td> Returns: </td> <td> vector <int> </td> </tr> <tr> <td> Method signature: </td> <td> vector <int> digits(int base) </td> </tr> <tr> <td colspan="2"> (be sure your method is public) </td> </tr> </tbody></table> </td> </tr> <tr> <td>      </td> </tr> <tr> <td> <br /></td> </tr> <tr> <td colspan="2"> <h3> Notes </h3> </td> </tr> <tr> <td valign="top" align="center"> - </td> <td> When <strong>base</strong> is greater than 10, digits may have a numeric value greater than 9. Because integers are displayed in base 10 by default, do not be alarmed when such digits appear on your screen as more than one decimal digit. For example, one of the interesting digits in base 16 is 15. </td> </tr> <tr> <td colspan="2"> <h3> Constraints </h3> </td> </tr> <tr> <td valign="top" align="center"> - </td> <td> <strong>base</strong> is between 3 and 30, inclusive. </td> </tr> <tr> <td colspan="2"> <h3> Examples </h3> </td> </tr> <tr> <td nowrap="true" align="center"> 0) </td> <td> <br /></td> </tr> <tr> <td>      </td> <td> <table> <tbody><tr> <td> <table> <tbody><tr> <td> <pre>10</pre> </td> </tr> </tbody></table> </td> </tr> <tr> <td> <pre>Returns: { 3, 9 }</pre> </td> </tr> <tr> <td> <table> <tbody><tr> <td colspan="2"> All other candidate digits fail for <strong>base</strong>=10. For example, 2 and 5 both fail on 100, for which 1+0+0=1. Similarly, 4 and 8 both fail on 216, for which 2+1+6=9, and 6 and 7 both fail for 126, for which 1+2+6=9. </td> </tr> </tbody></table> </td> </tr> </tbody></table> </td> </tr> <tr> <td nowrap="true" align="center"> 1) </td> <td> <br /></td> </tr> <tr> <td>      </td> <td> <table> <tbody><tr> <td> <table> <tbody><tr> <td> <pre>3</pre> </td> </tr> </tbody></table> </td> </tr> <tr> <td> <pre>Returns: { 2 }</pre> </td> </tr> <tr> <td> <br /></td> </tr> </tbody></table> </td> </tr> <tr> <td nowrap="true" align="center"> 2) </td> <td> <br /></td> </tr> <tr> <td>      </td> <td> <table> <tbody><tr> <td> <table> <tbody><tr> <td> <pre>9</pre> </td> </tr> </tbody></table> </td> </tr> <tr> <td> <pre>Returns: { 2, 4, 8 }</pre> </td> </tr> <tr> <td> <br /></td> </tr> </tbody></table> </td> </tr> <tr> <td nowrap="true" align="center"> 3) </td> <td> <br /></td> </tr> <tr> <td>      </td> <td> <table> <tbody><tr> <td> <table> <tbody><tr> <td> <pre>26</pre> </td> </tr> </tbody></table> </td> </tr> <tr> <td> <pre>Returns: { 5, 25 }</pre> </td> </tr> <tr> <td> <br /></td> </tr> </tbody></table> </td> </tr> <tr> <td nowrap="true" align="center"> 4) </td> <td> <br /></td> </tr> <tr> <td>      </td> <td> <table> <tbody><tr> <td> <table> <tbody><tr> <td> <pre>30</pre> </td> </tr> </tbody></table> </td> </tr> <tr> <td> <pre>Returns: { 29 }</pre> </td> </tr> <tr> <td> <br /></td> </tr> </tbody></table> </td> </tr> </tbody></table> <p> 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. </p> </div><br />棰樻剰緇欏畾base榪涘埗鏁伴噷錛屾壘鍑洪噷闈㈡墍鏈夌殑鐗瑰埆鐨勬暟x,瀵逛簬x鐨勫嶆暟kx錛屽畠鐨勬瘡涓浣嶇殑鍜岃繕鏄痻鐨勫嶆暟銆?br />姣斿base=10錛屽垯x=3鍜?銆?br /><br />榪欎釜搴旇鏄皬瀛︽椂鍊欏氨璁板緱鐨勭粨璁轟簡錛屼笓闂ㄧ畻3鍜?鐨勶紝鍝堝搱銆?br /><br />緇撹錛歜ase %x==1鏄厖瑕佹潯浠躲?br />璇佹槑錛?br />               a=a1*base^0+a2*base^1+a3*base^2,瀵逛簬浠諱綍a閮藉彲浠ヨ繖鏍峰垎瑙?br />        鍥犱負 base % x=1錛屽垯base^k %x==1銆傚垯涓婂紡鍖栫畝涓?br />               a==a1+a2+a3+.. (mod x)<br />         鍙嶄箣錛屼篃鍙緱base %x==1<br /><br />440PT鍟婏紝灝忓皬鐘硅鮑浜嗕笅鍝︺傜洿鎺ユ灇涓句簡x楠岃瘉鍟娿?br /><br />鍏跺疄灝辨槸姹俠ase-1鐨勫洜瀛愶紝濡傛灉base寰堝ぇ鍦拌瘽錛屾槸涓嶈兘榪欐牱鍘繪灇涓劇殑銆傚洜瀛愬垎瑙e摝錛屽張鏄粡鍏擱棶棰樺晩銆?br /><br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">#include</span><span style="color: #000000; "><</span><span style="color: #000000; ">stdio.h</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">string</span><span style="color: #000000; ">.h</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include</span><span style="color: #000000; "><</span><span style="color: #000000; ">vector</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include</span><span style="color: #000000; "><</span><span style="color: #000000; ">algorithm</span><span style="color: #000000; ">></span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">using</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">namespace</span><span style="color: #000000; "> std;<br /><br /></span><span style="color: #0000FF; ">class</span><span style="color: #000000; "> InterestingDigits{<br /></span><span style="color: #0000FF; ">public</span><span style="color: #000000; ">:<br />    vector </span><span style="color: #000000; "><</span><span style="color: #0000FF; ">int</span><span style="color: #000000; ">></span><span style="color: #000000; "> digits(</span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">base</span><span style="color: #000000; ">){<br />        </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> a[</span><span style="color: #000000; ">31</span><span style="color: #000000; ">];<br />        </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> n</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br />        </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> i</span><span style="color: #000000; ">=</span><span style="color: #000000; ">2</span><span style="color: #000000; ">;<br />        </span><span style="color: #0000FF; ">while</span><span style="color: #000000; "> (i</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">base</span><span style="color: #000000; ">){<br />            </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (</span><span style="color: #0000FF; ">base</span><span style="color: #000000; "> </span><span style="color: #000000; ">%</span><span style="color: #000000; "> i</span><span style="color: #000000; ">==</span><span style="color: #000000; ">1</span><span style="color: #000000; ">)<br />                a[n</span><span style="color: #000000; ">++</span><span style="color: #000000; ">]</span><span style="color: #000000; ">=</span><span style="color: #000000; ">i;<br />            i</span><span style="color: #000000; ">++</span><span style="color: #000000; ">;<br />        }<br />        vector </span><span style="color: #000000; "><</span><span style="color: #0000FF; ">int</span><span style="color: #000000; ">></span><span style="color: #000000; "> ans(n);<br />        </span><span style="color: #0000FF; ">for</span><span style="color: #000000; "> (i</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;i</span><span style="color: #000000; "><</span><span style="color: #000000; ">n;i</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)<br />            ans[i]</span><span style="color: #000000; ">=</span><span style="color: #000000; ">a[i];<br />        </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> ans;<br />    }<br />};</span></div><br /><br /><br /><img src ="http://www.shnenglu.com/ArcTan/aggbug/183609.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/ArcTan/" target="_blank">wangs</a> 2012-07-15 21:54 <a href="http://www.shnenglu.com/ArcTan/articles/183609.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>SRM 150 DIV 2 250pt錛堥槦鍒楋級http://www.shnenglu.com/ArcTan/articles/183599.htmlwangswangsSun, 15 Jul 2012 13:37:00 GMThttp://www.shnenglu.com/ArcTan/articles/183599.htmlhttp://www.shnenglu.com/ArcTan/comments/183599.htmlhttp://www.shnenglu.com/ArcTan/articles/183599.html#Feedback0http://www.shnenglu.com/ArcTan/comments/commentRss/183599.htmlhttp://www.shnenglu.com/ArcTan/services/trackbacks/183599.html

Problem Statement

    

When a widget breaks, it is sent to the widget repair shop, which is capable of repairing at most numPerDay widgets per day. Given a record of the number of widgets that arrive at the shop each morning, your task is to determine how many days the shop must operate to repair all the widgets, not counting any days the shop spends entirely idle.

For example, suppose the shop is capable of repairing at most 8 widgets per day, and over a stretch of 5 days, it receives 10, 0, 0, 4, and 20 widgets, respectively. The shop would operate on days 1 and 2, sit idle on day 3, and operate again on days 4 through 7. In total, the shop would operate for 6 days to repair all the widgets.

Create a class WidgetRepairs containing a method days that takes a sequence of arrival counts arrivals (of type vector <int>) and an int numPerDay, and calculates the number of days of operation.

Definition

    
Class: WidgetRepairs
Method: days
Parameters: vector <int>, int
Returns: int
Method signature: int days(vector <int> arrivals, int numPerDay)
(be sure your method is public)
    

Constraints

- arrivals contains between 1 and 20 elements, inclusive.
- Each element of arrivals is between 0 and 100, inclusive.
- numPerDay is between 1 and 50, inclusive.

Examples

0)
    
{ 10, 0, 0, 4, 20 }
8
Returns: 6
The example above.
1)
    
{ 0, 0, 0 }
10
Returns: 0

2)
    
{ 100, 100 }
10
Returns: 20

3)
    
{ 27, 0, 0, 0, 0, 9 }
9
Returns: 4

4)
    
{ 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6 }
3
Returns: 15

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 />姹傜殑鐨勫仛鐨勫ぉ鏁版槸澶氬皯錛屾病鏈夊仛鐨勯偅澶╀笉鐢ㄧ畻銆?br />
228PT錛岄熷害榪樻槸鎱簡鐐廣?br />
#include<stdio.h>
#include
<algorithm>
#include
<string.h>
#include
<vector>
using namespace std;

class WidgetRepairs{
public:
    
int days(vector <int> arrivals, int numPerDay){
        
int n=arrivals.size();
        
int now=0;
        
int i=0;
        
int tot=0;
        
while (i<|| now)  //榪欓噷鍙互浼樺寲涓涓嬶紝濡傛灉i==n灝變笉鐢ㄥ驚鐜簡錛屽墿涓嬬殑闇瑕佸畬鎴愮殑澶╂暟涓?now-1)/numPerDay+1銆?br />        {
            
if (i<n)
                now
+=arrivals[i];
            
if (now>0)   //絎竴嬈¤繖閲岀悊瑙i敊浜嗭紝浠ュ悗瑕佹妸緇嗚妭鎼炴竻妤氬晩銆傘傘?br />                tot++;
            now
=now>numPerDay?now-numPerDay:0;    
            i
++;
        }
        
return tot;
    }
};









wangs 2012-07-15 21:37 鍙戣〃璇勮
]]>
SRM549 DIV鈪?1000pt錛圓OV緗戞嫇鎵戞帓搴忥級http://www.shnenglu.com/ArcTan/articles/182546.htmlwangswangsTue, 10 Jul 2012 01:59:00 GMThttp://www.shnenglu.com/ArcTan/articles/182546.htmlhttp://www.shnenglu.com/ArcTan/comments/182546.htmlhttp://www.shnenglu.com/ArcTan/articles/182546.html#Feedback0http://www.shnenglu.com/ArcTan/comments/commentRss/182546.htmlhttp://www.shnenglu.com/ArcTan/services/trackbacks/182546.html

Problem Statement

     The Order of the Hats is a magical organization. One of their duties is to teach students how to cast spells. There are N spells numbered from 0 to N-1. As an aid for the students, the teachers have prepared a spell chart. The chart lists suggestions on the order in which to study the spells. (This is explained in more detail below.)

Recently, some changelings broke into the Order's spell archive and messed up the spell chart. You are given a String[] spellChart containing the new, messed-up state of the spell chart. Each character of each element of spellChart is either 'Y' or 'N'. The students will come to study soon. They will interpret the chart in the following way: If spellChart[i][j] is 'Y' then spell i must be learned before spell j.

As the chart is now messed up, it may be impossible to learn all the spells in the chart because of cycles in the requirements. Your task is to repair the given chart. Determine the minimum number of changes needed to remove all the cycles in the requirements. In a single change, you may either change some character spellChart[i][j] from 'Y' to 'N', or change some character from 'N' to 'Y'.

Definition

    
Class: OrderOfTheHats
Method: minChanged
Parameters: String[]
Returns: int
Method signature: int minChanged(String[] spellChart)
(be sure your method is public)
    

Constraints

- spellChart will contain between 1 and 20 elements, inclusive.
- Each element of spellChart will contain N characters, where N is the number of elements in spellChart.
- Each character in each element of spellChart will be either 'Y' or 'N'.

Examples

0)
    
{"Y"}
Returns: 1
This spell chart contains a spell that should be learned before itself. The students would never be able to learn such a spell. We can remove this cyclic dependency by changing the 'Y' to 'N'.
1)
    
{"NYN",  "NNY",  "NNN"}
Returns: 0
This spell chart is already OK.
2)
    
{"NYN",  "NNY",  "YNN"}
Returns: 1
Changing any single 'Y' to a 'N' will fix this spell chart.
3)
    
{"NYYYYYY",  "YNYYYYY",  "YYNYYYY",  "YYYNYYY",  "YYYYNYY",  "YYYYYNY",  "YYYYYYN"}
Returns: 21

4)
    
{"NNNY",  "YNYN",  "YNNN",  "YYYN"}
Returns: 1

5)
    
{"YYYYYNNYYYNYNNNNYNNY",  "NYNNNYYNNYNYYYNYYYYY",  "NNYNNNYYNNNNNNYYYYNY",  "YYNYNYYNNYYYNYNNNYYY",  "NYYNNYNYNYNNNNYYYNYN",  "NNNNNYYNYNNYYYYNYYYN",  "YNYNYYNNNYNNNNNYNNYY",  "NYYYYNYNYNNYNNYNNNNY",  "YYYYNYYNNYYYNNYNNYNY",  "YYYYYYNYNYNYNNNNNNYN",  "NNYYYYYNNNYNNNYNNNNY",  "YYNNNYNYYNYYNYYNYNYN",  "NNYNYYNYYNYYNYNYNYYN",  "YNYNYYNYNNNYNYNYYNYY",  "NNYNNNYYYYYYYYYYYNYY",  "YYYYYNYYNYYYYYNNYNNN",  "NYYYYYYYYNNNNNYYNNYN",  "YNNYNNNYYNYYYNYNYYYY",  "YYNNYNYYYNYYNNNYYNNY",  "NNYNYNYYYNYYNYNNYNNN"}
Returns: 79

6)
    
{"YYNYNN",  "YNYNNY",  "YYYYNN",  "NNNYNN",  "NNNYNN",  "YNYNYN"}
Returns: 5

7)
    
{"NNNNNNNNNN",  "NNNNNNNNNN",  "NNNYNNYNNN",  "NNNYNNYNNN",  "NNNYNNYNNN",  "NNNNNNNNNN",  "NNYYYYYYNN",  "NNYNNNNYNN",  "NNNYYYYNNN",  "NNNNNNNNNN"}
Returns: 6

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.




棰樻剰錛氱粰瀹氫竴寮燦*N鐨刴ap錛孨涓《鐐圭殑鍥撅紝map[i][j]=='Y'錛?lt;i,j>錛屽惁鍒?lt;j,i>銆傛眰鏈灝忕殑杞崲Y鎴栬匩錛屼嬌璇ュ浘娌℃湁鐜紒

鎬濊礬錛氭庝箞鍋氬憿錛焧hinking






wangs 2012-07-10 09:59 鍙戣〃璇勮
]]>
SRM549 DIV鈪?500pt(鏈澶у尮閰?http://www.shnenglu.com/ArcTan/articles/182540.htmlwangswangsTue, 10 Jul 2012 01:14:00 GMThttp://www.shnenglu.com/ArcTan/articles/182540.htmlhttp://www.shnenglu.com/ArcTan/comments/182540.htmlhttp://www.shnenglu.com/ArcTan/articles/182540.html#Feedback0http://www.shnenglu.com/ArcTan/comments/commentRss/182540.htmlhttp://www.shnenglu.com/ArcTan/services/trackbacks/182540.html

Problem Statement

     The Order of All Things Pointy and Magical has commissioned the creation of some new wizard hats. A wizard hat is created by taking two cones: a decorative top cone, and a warm and fluffy bottom cone. To assemble the hat, both cones are first placed onto a table, so that their bases are horizontal and their apexes point upwards. The top cone is then lifted and placed onto the bottom cone. The base of the top cone has to remain horizontal, and the apex of the top cone must be strictly above the apex of the bottom cone.

Not every pair of cones can be used to create a wizard hat. A wizard hat is only produced if the following two criteria are both met:
  • The apex of the top cone must be strictly above the apex of the bottom cone. I.e., when the top cone is placed on top of the bottom cone and released, their apexes must not touch.
  • Some part of the bottom cone must remain visible to form the brim of the hat. (Otherwise, the hat would look like a simple cone, not like a wizard hat!)
You have several top cones and several bottom cones of various sizes. Each cone can be described by its height (the distance between the apex and the base) and by the radius of its base. The top cones you have are described by topHeight and topRadius: for each valid i, you have one top cone with height topHeight[i] and radius topRadius[i]. The bottom cones you have are described by bottomHeight and bottomRadius in the same way.

Your task is to determine the maximum number of wizard hats you can make using each of the available top and bottom cones at most once.

Definition

    
Class: PointyWizardHats
Method: getNumHats
Parameters: vector <int>, vector <int>, vector <int>, vector <int>
Returns: int
Method signature: int getNumHats(vector <int> topHeight, vector <int> topRadius, vector <int> bottomHeight, vector <int> bottomRadius)
(be sure your method is public)
    

Constraints

- topHeight and topRadius will contain the same number of elements.
- bottomHeight and bottomRadius will contain the same number of elements.
- topHeight will contain between 1 and 50 elements, inclusive.
- topRadius will contain between 1 and 50 elements, inclusive.
- bottomHeight will contain between 1 and 50 elements, inclusive.
- bottomRadius will contain between 1 and 50 elements, inclusive.
- Each element of topHeight, topRadius, bottomHeight, and bottomRadius will be between 1 and 10,000, inclusive.

Examples

0)
    
{30}
{3}
{3}
{30}
Returns: 1
The top and bottom cone can be used together to make a wizard hat.
1)
    
{4,4}
{4,3}
{5,12}
{5,4}
Returns: 1
The only way to produce a wizard hat is to use the top cone 1 (height 4, radius 3) and the bottom cone 0 (height 5, radius 5).
2)
    
{3}
{3}
{1,1}
{2,4}
Returns: 1

3)
    
{10,10}
{2,5}
{2,9}
{3,6}
Returns: 2

4)
    
{3,4,5}
{5,4,3}
{3,4,5}
{3,8,5}
Returns: 2

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

6)
    
{123,214,232,323,342,343}
{123,123,232,123,323,434}
{545,322,123,545,777,999}
{323,443,123,656,767,888}
Returns: 5

7)
    
{999,999,999,10000,10000,10000}
{10000,10000,10000,1,2,3}
{2324,2323,234,5454,323,232}
{1,2,3222,434,5454,23}
Returns: 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.





棰樻剰錛氫竴涓猦at鐢變笂闈op cone鍜屼笅闈㈢殑bottom cone緇勬垚銆傜粰瀹氫笂闈one鐨勯珮鍜屽簳鍗婂緞錛宼opHeigh[],topRadius[]涓嬮潰cone鐨刡ottomHeight[],bottomRadius[]
         涓婁笅涓や釜cone緇勬垚hat闇瑕佹弧瓚蟲潯浠訛細
                  1錛歍he apex of the top cone must be strictly above the apex of the bottom cone. I.e., when the top cone is placed on top of the bottom cone and released, their apexes must not touch.
                  2錛歋ome part of the bottom cone must remain visible to form the brim of the hat. (Otherwise, the hat would look like a simple cone, not like a wizard hat!)


鎬濊礬錛氭眰浜屽垎鍥劇殑鏈澶у尮閰嶏紝妯$増棰樸?/span>
         topcone 鍜宐ottomcone婊¤凍鐨勬潯浠舵槸錛歵opR<bottomR && topR*bottomH<topH*bottomR

閿欒鎻愪氦浜嗕竴嬈★紝灝肩帥錛侊紒錛佺姽璞笉鍐充笉鏁oding涓嶈鍛錛侊紒

175.22pt
              
#include<stdio.h>
#include
<string>
#include
<vector>
#include
<algorithm>
using namespace std;
bool map[55][55];
int result[55];
bool state[55];
int n,m;
class PointyWizardHats{
public:
    
int find(int x)
    {
        
int i;
        
for (i=0;i<m ;i++ )
        {
            
if (map[x][i]==1 && !state[i])
            {
                state[i]
=1;
                
if (result[i]==-1 || find(result[i]))
                {
                    result[i]
=x;
                    
return 1;
                }
            }
        }
        
return 0;
    }
    
bool can(int x1,int y1,int x2,int y2) //榪欎釜鏉′歡鎴戠姽璞簡鍗婂ぉ錛宼hinking涓嶅鍟婏紒
    {
        
if (y2*x1>y1*x2 && y2>y1)
            
return 1;
        
return 0;
    }
    
int getNumHats(vector <int> topHeight, vector <int> topRadius, vector <int> bottomHeight, vector <int> bottomRadius){

        
int i,j;
        
int ans;
        n
=topHeight.size();
        m
=bottomHeight.size();
        memset(map,
0,sizeof(map));
        
for (j=0;j<m;j++)
            result[j]
=-1;    //榪欓噷涔嬪墠鍏ㄩ儴璁劇疆鐨?鍟婂晩鍟婏紒錛侊紒
        
for (i=0;i<n;i++)
            
for (j=0;j<m;j++)
                
if (can(topHeight[i],topRadius[i],bottomHeight[j],bottomRadius[j]))
                    map[i][j]
=1;
        ans
=0;
        
for (i=0;i<n;i++)
        {
            memset(state,
0,sizeof(state));
            
if (find(i))
                ans
++;
        }
        
return ans;
    }
};





wangs 2012-07-10 09:14 鍙戣〃璇勮
]]>
SRM549 DIV鈪?250pt (姒傜巼鎯蟲硶棰?http://www.shnenglu.com/ArcTan/articles/182532.htmlwangswangsTue, 10 Jul 2012 01:03:00 GMThttp://www.shnenglu.com/ArcTan/articles/182532.htmlhttp://www.shnenglu.com/ArcTan/comments/182532.htmlhttp://www.shnenglu.com/ArcTan/articles/182532.html#Feedback0http://www.shnenglu.com/ArcTan/comments/commentRss/182532.htmlhttp://www.shnenglu.com/ArcTan/services/trackbacks/182532.html

Problem Statement

     A magician has invited you to play a game. For this game, the magician uses a special table. On the table there are three spots in a row. The spots are labeled 0, 1, and 2, in order. He places three hats onto the table, so that each hat covers one of the spots. He then takes a ball and places it under one of the hats. The hats are not transparent, so you cannot see the ball while it is under a hat. Next, the magician shuffles the hats by repeatedly swapping two adjacent hats. Each swap is done by sliding the hats along the table, never showing you the ball. Once the magician finishes swapping the hats, you have to guess the spot where the ball is.

You are given a string hats which describes the contents of the hats in the beginning of the game. The i-th character of hats is 'o' if the ball was initially on the spot i. Otherwise, the i-th character of hats is '.' (a period).

You are also given a int numSwaps. Assume that the magician swapped the hat that contained the ball exactly numSwaps times. Please remember that in our version of the game the magician always swaps two adjacent hats. Also, note that the total number of swaps in the game may be larger than numSwaps, because the magician may sometimes swap two hats that don't contain the ball.

Assume that the magician chose the swaps he makes uniformly at random. That is, in each turn with probability 50% he swapped the hats on spots 0 and 1, and with probability 50% he swapped the hats on spots 1 and 2. Return the number of the spot that is most likely to contain the ball at the end of the game. If multiple spots are tied for the largest probability, return the smallest one of them.

Definition

    
Class: BallAndHats
Method: getHat
Parameters: string, int
Returns: int
Method signature: int getHat(string hats, int numSwaps)
(be sure your method is public)
    

Notes

- Two hats are adjacent if their spots differ by 1.

Constraints

- hats will contain exactly three characters.
- hats will contain exactly one 'o' character.
- hats will contain exactly two '.' characters.
- numSwaps will be between 0 and 1000, inclusive.

Examples

0)
    
".o."
1
Returns: 0
The spots 0 and 2 are equally likely to contain the ball after the hat that contains it is swapped once. We return the smallest spot number, which is 0.
1)
    
"..o"
0
Returns: 2
The ball does not change spots when 0 swaps are performed; therefore, the ball must be at spot 2.
2)
    
"o.."
1
Returns: 1

3)
    
"..o"
2
Returns: 0

4)
    
"o.."
101
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.




棰樻剰錛氱粰涓変釜甯藉瓙錛屼竴涓附瀛愪笅闈㈡湁姘旂悆銆備竴嬈WAP鍙皢鐩擱偦鐨勪袱涓附瀛愪氦鎹€傛瘡嬈WAP鐨勬鐜囦竴鏍風殑錛?鍜?錛?鍜?浜ゆ崲鐨勬鐜囬兘鏄?0%銆傜粰鍑哄垵濮嬬姸鎬侊紝鎬誨叡鏈塶umSwaps嬈WAP浜嗗甫姘旂悆鐨勫附瀛愩傞棶鏈鍚庢皵鐞冨湪鍝釜浣嶇疆鐨勬鐜囨渶澶э紝濡傛灉鏈夊嚑涓綅緗紝鍒欐眰鏈灝忕殑浣嶇疆銆?br />
鎬濊礬錛氭兂娉曢錛乶umSwaps濂囧伓鎬ц璁哄垎鏋?/span>

176.5pt  thinking閫熷害澶綆錛屽鍒嗘瀽鍒嗘瀽錛岄敾鐐兼濈淮鍝︼紒
#include<string>
using namespace std;
class BallAndHats{
public:
    
int getHat(string hats, int numSwaps){
        
int i=0;
        
while (hats[i]!='o')    i++;
        
if (numSwaps==0)
            
return i;
        numSwaps
%=2;
        
if (i==0 && numSwaps==0)
            
return 0;
        
if (i==1 && numSwaps==1)
            
return 0;
        
if (i==2 && numSwaps==0)
            
return 0;
        
return 1;
    }
};






wangs 2012-07-10 09:03 鍙戣〃璇勮
]]>
SRM548 DIV鈪★紞500PT錛堜簩鍒嗙瓟妗圤R璐績錛?/title><link>http://www.shnenglu.com/ArcTan/articles/181224.html</link><dc:creator>wangs</dc:creator><author>wangs</author><pubDate>Tue, 03 Jul 2012 02:15:00 GMT</pubDate><guid>http://www.shnenglu.com/ArcTan/articles/181224.html</guid><wfw:comment>http://www.shnenglu.com/ArcTan/comments/181224.html</wfw:comment><comments>http://www.shnenglu.com/ArcTan/articles/181224.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/ArcTan/comments/commentRss/181224.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/ArcTan/services/trackbacks/181224.html</trackback:ping><description><![CDATA[浜屽垎絳旀鍊掓槸寰堝揩灝辨兂鍒頒簡鐨勶紝鍒氬紑濮嬫病鏈夋兂濂芥庝箞楠岃瘉check()銆傚悗闈㈠氨璺湪榪欓噷浜嗐傘傘傘倀ree.height>=1鍟娿傘傘?br />姣涘摜緇欑殑鍔炴硶鏄鐨勶紝璐績銆侽RZ錛孫RZ錛屾垜娌″啓鍛銆傘傘傘?br />鐖嗛浂銆傘傚叾瀹炲簲璇ユ灉鏂彁浜ょ殑鍚э紵<br /><div><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><span style="color: #000000; ">#include</span><span style="color: #000000; "><</span><span style="color: #000000; ">stdio.h</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">string</span><span style="color: #000000; ">.h</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include</span><span style="color: #000000; "><</span><span style="color: #000000; ">vector</span><span style="color: #000000; ">></span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">using</span> <span style="color: #0000FF; ">namespace</span><span style="color: #000000; "> std;<br /></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> h[</span><span style="color: #000000; ">55</span><span style="color: #000000; ">],n;<br /></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> max(</span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> x,</span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> y)<br />{<br />    </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> x</span><span style="color: #000000; ">></span><span style="color: #000000; ">y</span><span style="color: #000000; ">?</span><span style="color: #000000; ">x:y;<br />}    <br /></span><span style="color: #0000FF; ">bool</span><span style="color: #000000; "> check(</span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> x)<br />{<br />        </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> last,now,i;<br />        last</span><span style="color: #000000; ">=</span><span style="color: #000000; ">max(h[</span><span style="color: #000000; ">0</span><span style="color: #000000; ">]</span><span style="color: #000000; ">-</span><span style="color: #000000; ">x,</span><span style="color: #000000; ">1</span><span style="color: #000000; ">);<br />        </span><span style="color: #0000FF; ">for</span><span style="color: #000000; "> (i</span><span style="color: #000000; ">=</span><span style="color: #000000; ">1</span><span style="color: #000000; ">;i</span><span style="color: #000000; "><</span><span style="color: #000000; ">n;i</span><span style="color: #000000; ">++</span><span style="color: #000000; ">){<br />            now</span><span style="color: #000000; ">=</span><span style="color: #000000; ">h[i];<br />            </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (now</span><span style="color: #000000; ">+</span><span style="color: #000000; ">x</span><span style="color: #000000; "><=</span><span style="color: #000000; ">last)<br />                </span><span style="color: #0000FF; ">return</span> <span style="color: #0000FF; ">false</span><span style="color: #000000; ">;<br />            last</span><span style="color: #000000; ">=</span><span style="color: #000000; ">max(last</span><span style="color: #000000; ">+</span><span style="color: #000000; ">1</span><span style="color: #000000; ">,now</span><span style="color: #000000; ">-</span><span style="color: #000000; ">x);<br />        }<br />        </span><span style="color: #0000FF; ">return</span> <span style="color: #0000FF; ">true</span><span style="color: #000000; ">;<br />}<br /></span><span style="color: #0000FF; ">class</span><span style="color: #000000; "> KingdomAndTrees{<br /></span><span style="color: #0000FF; ">public</span><span style="color: #000000; ">:<br /><br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> minLevel(vector </span><span style="color: #000000; "><</span><span style="color: #0000FF; ">int</span><span style="color: #000000; ">></span><span style="color: #000000; "> heights){<br />        </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> l,r,mid,i;<br />        n</span><span style="color: #000000; ">=</span><span style="color: #000000; ">heights.size();<br />        </span><span style="color: #0000FF; ">for</span><span style="color: #000000; "> (i</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;i</span><span style="color: #000000; "><</span><span style="color: #000000; ">n;i</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)<br />            h[i]</span><span style="color: #000000; ">=</span><span style="color: #000000; ">heights[i];<br />        l</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;r</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br />        </span><span style="color: #0000FF; ">for</span><span style="color: #000000; "> (i</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;i</span><span style="color: #000000; "><</span><span style="color: #000000; ">n;i</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)<br />            </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (h[i]</span><span style="color: #000000; ">></span><span style="color: #000000; ">r)<br />                r</span><span style="color: #000000; ">=</span><span style="color: #000000; ">h[i];<br />        r</span><span style="color: #000000; ">=</span><span style="color: #000000; ">r</span><span style="color: #000000; ">+</span><span style="color: #000000; ">n;<br />        </span><span style="color: #0000FF; ">while</span><span style="color: #000000; "> (l</span><span style="color: #000000; "><</span><span style="color: #000000; ">r){<br />            mid</span><span style="color: #000000; ">=</span><span style="color: #000000; ">(l</span><span style="color: #000000; ">+</span><span style="color: #000000; ">r)</span><span style="color: #000000; ">/</span><span style="color: #000000; ">2</span><span style="color: #000000; ">;<br />            </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (check(mid))<br />                r</span><span style="color: #000000; ">=</span><span style="color: #000000; ">mid;<br />            </span><span style="color: #0000FF; ">else</span><span style="color: #000000; "><br />                l</span><span style="color: #000000; ">=</span><span style="color: #000000; ">mid</span><span style="color: #000000; ">+</span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />        }<br />        </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> r;    <br />    }<br />};</span></div> <br /> 涓嬫TC瑕侀洩鑰繪墠琛岋紒<br /> </div><br /><br /><br /><img src ="http://www.shnenglu.com/ArcTan/aggbug/181224.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/ArcTan/" target="_blank">wangs</a> 2012-07-03 10:15 <a href="http://www.shnenglu.com/ArcTan/articles/181224.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>SRM548 DIV鈪★紞250PT錛堢函姘撮錛?/title><link>http://www.shnenglu.com/ArcTan/articles/181223.html</link><dc:creator>wangs</dc:creator><author>wangs</author><pubDate>Tue, 03 Jul 2012 02:09:00 GMT</pubDate><guid>http://www.shnenglu.com/ArcTan/articles/181223.html</guid><wfw:comment>http://www.shnenglu.com/ArcTan/comments/181223.html</wfw:comment><comments>http://www.shnenglu.com/ArcTan/articles/181223.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/ArcTan/comments/commentRss/181223.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/ArcTan/services/trackbacks/181223.html</trackback:ping><description><![CDATA[<span style="color: #000000; "></span>絎簩嬈″仛TC錛屾病鑳戒繚浣忕豢鑹層?82.0PT<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">#include</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">string</span><span style="color: #000000; ">.h</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include</span><span style="color: #000000; "><</span><span style="color: #000000; ">vector</span><span style="color: #000000; ">></span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">using</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">namespace</span><span style="color: #000000; "> std;<br /></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> t[</span><span style="color: #000000; ">51</span><span style="color: #000000; ">];<br /></span><span style="color: #0000FF; ">class</span><span style="color: #000000; "> KingdomAndDucks{<br /></span><span style="color: #0000FF; ">public</span><span style="color: #000000; ">:<br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> minDucks(vector </span><span style="color: #000000; "><</span><span style="color: #0000FF; ">int</span><span style="color: #000000; ">></span><span style="color: #000000; "> duckTypes){<br />        </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> n,i,max,m;<br />        memset(t,</span><span style="color: #000000; ">0</span><span style="color: #000000; ">,</span><span style="color: #0000FF; ">sizeof</span><span style="color: #000000; ">(t));<br />        n</span><span style="color: #000000; ">=</span><span style="color: #000000; ">duckTypes.size();<br />        </span><span style="color: #0000FF; ">for</span><span style="color: #000000; "> (i</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;i</span><span style="color: #000000; "><</span><span style="color: #000000; ">n;i</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)<br />            t[duckTypes[i]]</span><span style="color: #000000; ">++</span><span style="color: #000000; ">;<br />        max</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;m</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br />        </span><span style="color: #0000FF; ">for</span><span style="color: #000000; "> (i</span><span style="color: #000000; ">=</span><span style="color: #000000; ">1</span><span style="color: #000000; ">;i</span><span style="color: #000000; "><=</span><span style="color: #000000; ">50</span><span style="color: #000000; ">;i</span><span style="color: #000000; ">++</span><span style="color: #000000; ">){<br />            </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (t[i]</span><span style="color: #000000; ">></span><span style="color: #000000; ">0</span><span style="color: #000000; ">)<br />                m</span><span style="color: #000000; ">++</span><span style="color: #000000; ">;<br />            max</span><span style="color: #000000; ">=</span><span style="color: #000000; ">max</span><span style="color: #000000; ">></span><span style="color: #000000; ">t[i]</span><span style="color: #000000; ">?</span><span style="color: #000000; ">max:t[i];<br />        }<br />        </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> m</span><span style="color: #000000; ">*</span><span style="color: #000000; ">max;<br />    }<br />};</span></div><br /><br />灝卞彧榪囦簡榪欎竴涓鐩紝緙栫爜閫熷害涓嶈鍛錛屽緱蹇揩緇冧範璧鋒潵錛?img src ="http://www.shnenglu.com/ArcTan/aggbug/181223.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/ArcTan/" target="_blank">wangs</a> 2012-07-03 10:09 <a href="http://www.shnenglu.com/ArcTan/articles/181223.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.shnenglu.com/" title="精品视频久久久久">精品视频久久久久</a> <div class="friend-links"> </div> </div> </footer> <a href="http://www.norid.cn" target="_blank">久久99热这里只有精品66</a>| <a href="http://www.daemontools.org.cn" target="_blank">久久婷婷午色综合夜啪</a>| <a href="http://www.tril.cn" target="_blank">亚洲精品乱码久久久久久蜜桃图片 </a>| <a href="http://www.33k4.cn" target="_blank">国产精品久久精品</a>| <a href="http://www.bodycode.net.cn" target="_blank">少妇久久久久久被弄高潮</a>| <a href="http://www.hzks666.cn" target="_blank">亚洲精品国产字幕久久不卡</a>| <a href="http://www.bluecc.com.cn" target="_blank">久久久亚洲AV波多野结衣</a>| <a href="http://www.myth9.cn" target="_blank">久久天天婷婷五月俺也去</a>| <a href="http://www.shiyana.cn" target="_blank">99久久做夜夜爱天天做精品</a>| <a href="http://www.168lala.cn" target="_blank">久久久久亚洲国产</a>| <a href="http://www.xx5a4.cn" target="_blank">中文无码久久精品</a>| <a href="http://www.003kd.cn" target="_blank">久久久久亚洲AV无码网站</a>| <a href="http://www.gmyz.net.cn" target="_blank">久久精品国产亚洲av水果派</a>| <a href="http://www.dpbz.net.cn" target="_blank">久久精品国产清高在天天线</a>| <a href="http://www.twhx.org.cn" target="_blank">99国产精品久久</a>| <a href="http://www.gongcheng100.cn" target="_blank">94久久国产乱子伦精品免费 </a>| <a href="http://www.daocheyingxiang.cn" target="_blank">久久青青国产</a>| <a href="http://www.miror.com.cn" target="_blank">久久乐国产综合亚洲精品</a>| <a href="http://www.51peini.cn" target="_blank">精品一二三区久久aaa片</a>| <a href="http://www.icq418.cn" target="_blank">久久精品国产亚洲av麻豆小说 </a>| <a href="http://www.zsputian.com.cn" target="_blank">久久精品麻豆日日躁夜夜躁</a>| <a href="http://www.hanfeng-foods.com.cn" target="_blank">欧美牲交A欧牲交aⅴ久久 </a>| <a href="http://www.yhic.net.cn" target="_blank">久久国产成人亚洲精品影院</a>| <a href="http://www.m28587.cn" target="_blank">亚洲国产日韩欧美久久</a>| <a href="http://www.00dh.cn" target="_blank">日韩AV无码久久一区二区 </a>| <a href="http://www.lawyer010.cn" target="_blank">日韩一区二区三区视频久久</a>| <a href="http://www.z1568.cn" target="_blank">无码任你躁久久久久久老妇App</a>| <a href="http://www.carnegietech.com.cn" target="_blank">久久久无码精品亚洲日韩京东传媒</a>| <a href="http://www.88815755.cn" target="_blank">亚洲AV日韩精品久久久久久久</a>| <a href="http://www.ppxp.com.cn" target="_blank">精品国产乱码久久久久久1区2区 </a>| <a href="http://www.cnshscj.cn" target="_blank">久久狠狠爱亚洲综合影院 </a>| <a href="http://www.ziximaker.cn" target="_blank">青春久久</a>| <a href="http://www.jumeiba.cn" target="_blank">久久婷婷五月综合97色</a>| <a href="http://www.otraveler.cn" target="_blank">国产精品免费久久</a>| <a href="http://www.west-data.cn" target="_blank">久久久精品人妻一区二区三区蜜桃</a>| <a href="http://www.wamiu.cn" target="_blank">久久精品无码专区免费东京热</a>| <a href="http://www.xggppz8.cn" target="_blank">国产99久久久国产精免费</a>| <a href="http://www.ls63.cn" target="_blank">综合久久国产九一剧情麻豆</a>| <a href="http://www.zhangmengm.cn" target="_blank">久久国产精品久久</a>| <a href="http://www.alichengde.cn" target="_blank">色妞色综合久久夜夜</a>| <a href="http://www.qcbijj.cn" target="_blank">久久婷婷国产麻豆91天堂</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>