01 2019 档案
摘要:水陆距离 描述 给定一个N x M的01矩阵,其中1表示陆地,0表示水域。对于每一个位置,求出它距离最近的水域的距离是多少。 矩阵中每个位置与它上下左右相邻的格子距离为1。 输入 第一行包含两个整数,N和M。 以下N行每行M个0或者1,代表地图。 数据保证至少有1块水域。 对于30%的数据,1 <=
阅读全文
摘要:矩形判断 给出平面上4条线段,判断这4条线段是否恰好围成一个面积大于0的矩形。 Input 输入第一行是一个整数T(1<=T<=100),代表测试数据的数量。 每组数据包含4行,每行包含4个整数x1, y1, x2, y2 (0 <= x1, y1, x2, y2 <= 100000);其中(x1,
阅读全文
摘要:List Sorting Excel can sort records according to any column. Now you are supposed to imitate this function. Input Specification: Each input file conta
阅读全文
摘要:Colors in Mars People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-dig
阅读全文
摘要:Deepest Root A graph which is connected and acyclic can be considered a tree. The hight of the tree depends on the selected root. Now you are supposed
阅读全文
摘要:Palindromic Number A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a
阅读全文
摘要:Have Fun with Numbers Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it
阅读全文
摘要:Digital Library A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and
阅读全文
摘要:Tree Traversals Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you ar
阅读全文
摘要:General Palindromic Number A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234
阅读全文
摘要:Public Bike Management There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One m
阅读全文