- 博客(6)
- 收藏
- 关注
原创 马的遍历——搜索(bfs/dfs)
题目描述有一个n*m的棋盘(1<n,m<=400),在某个点上有一个马,要求你计算出马到达棋盘上任意一个点最少要走几步输入格式一行四个数据,棋盘的大小和马的坐标输出格式一个n*m的矩阵,代表马到达某个点最少要走几步(左对齐,宽5格,不能到达则输出-1)输入输出样例输入3 3 1 1输出0 3 23 -1 12 1 4题意:在一个二维数组中,马到每一个坐标所需要的步数是多少,若无法到达,则为-1。题解:首先要确定马可
2021-03-27 17:08:27
895
原创 HDU - 5879
Given an integer n, we only want to know the sum of 1/k^2 where k from 1 to n.InputThere are multiple cases.For each test case, there is a single line, containing a single positive integer n.The input file is at most 1M.OutputThe required sum, r.
2020-12-10 19:28:24
143
原创 LightOJ - 1008
Fibsieve had a fantabulous (yes, it’s an actual word) birthday party this year. He had so many gifts that he was actually thinking of not having a party next year.Among these gifts there was an N x N glass chessboard that had a light in each of its cells.
2020-12-09 21:24:01
182
原创 LightOJ - 1010
Given an m x n chessboard where you want to place chess knights. You have to find the number of maximum knights that can be placed in the chessboard such that no two knights attack each other.Those who are not familiar with chess knights, note that a che.
2020-12-08 20:07:23
208
原创 HDU - 2138
Give you a lot of positive integers, just to find out how many prime numbers there are.InputThere are a lot of cases. In each case, there is an integer N representing the number of integers to find. Each integer won’t exceed 32-bit signed integer, and.
2020-12-07 20:34:05
143
原创 POJ - 2586
Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc.All what they remember is that MS Inc. posted a surplus or a deficit each month of 1999 and each month when MS Inc. po.
2020-12-07 19:30:09
221
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人