
Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
History is littered with hundreds of conflicts over the future of a community, group, location or business that were "resolved" when one of the parties stepped ahead and destroyed what was there. With the original point of contention destroyed, the debates would fall to the wayside. Archive Team believes that by duplicated condemned data, the conversation and debate can continue, as well as the richness and insight gained by keeping the materials. Our projects have ranged in size from a single volunteer downloading the data to a small-but-critical site, to over 100 volunteers stepping forward to acquire terabytes of user-created data to save for future generations.
The main site for Archive Team is at archiveteam.org and contains up to the date information on various projects, manifestos, plans and walkthroughs.
This collection contains the output of many Archive Team projects, both ongoing and completed. Thanks to the generous providing of disk space by the Internet Archive, multi-terabyte datasets can be made available, as well as in use by the Wayback Machine, providing a path back to lost websites and work.
Our collection has grown to the point of having sub-collections for the type of data we acquire. If you are seeking to browse the contents of these collections, the Wayback Machine is the best first stop. Otherwise, you are free to dig into the stacks to see what you may find.
The Archive Team Panic Downloads are full pulldowns of currently extant websites, meant to serve as emergency backups for needed sites that are in danger of closing, or which will be missed dearly if suddenly lost due to hard drive crashes or server failures.
On an 8 x 8 chessboard, there is one white rook. There also may be empty squares, white bishops, and black pawns. These are given as characters 'R', '.', 'B', and 'p' respectively. Uppercase characters represent white pieces, and lowercase characters represent black pieces.
The rook moves as in the rules of Chess: it chooses one of four cardinal directions (north, east, west, and south), then moves in that direction until it chooses to stop, reaches the edge of the board, or captures an opposite colored pawn by moving to the same square it occupies. Also, rooks cannot move into the same square as other friendly bishops.
Return the number of pawns the rook can capture in one move.
Example 1:
Example 2:
Example 3:
Note:
board.length == board[i].length == 8
board[i][j]
is either'R'
,'.'
,'B'
, or'p'
board[i][j] == 'R'
这道题给了一个
8x8
大小的国际象棋棋盘,上面只能有三种棋子,分别是白方的车,白方的象,和黑方的兵,问白色方的车最多能吃到多个黑方的兵。在国际象棋中,车是可以上下左右走的,若某条路径上先遇到了白方的象,则该路上没法吃兵了,若先遇上了兵,可以吃,但此时后面若还有兵,不能连续吃。搞懂了题意其实很简单了,首先遍历棋盘,找到白方车的位置,然后最简单粗暴的方法是,四个方向分别用 for 循环来遍历,若遇到白方的象,直接 break,若遇到兵,则结果 res 自增1,然后 break 即可,参见代码如下:解法一:
我们也可以不用写那么 for 循环,而是利用深度优先遍历 DFS 的思想,用方向数组,每次加上方向的偏移,若没有越界,则判断,若是黑兵,则结果 res 加1,若不是点,则 break,这判断很精髓,覆盖了当前是白象或黑兵的情况,保证了遇到了白象,或者已经吃了黑兵之后可以 break,然后继续增加偏移量直至退出循环,参见代码如下:
解法二:
Github 同步地址:
#999
参考资料:
https://leetcode.com/problems/available-captures-for-rook/
https://leetcode.com/problems/available-captures-for-rook/discuss/242924/C%2B%2BJava-search-and-capture
https://leetcode.com/problems/available-captures-for-rook/discuss/242932/JavaC%2B%2BPython-Straight-Forward-Solution
LeetCode All in One 题目讲解汇总(持续更新中...)
The text was updated successfully, but these errors were encountered: