Timus #1155

题目说明:立方体相邻两点可以同时相加或相减,要把每个点变为0的过程

解题思路:
1. 要有解则A + C + F + H = B + D + E + G
2. 进入循环直至每个点为0
3. 找到最小的位置。如果这个最小的位置旁边3个点都为0,则找到另外一个有数的点,再找这两点分别相邻的相邻的点加1。如果这个最小的位置旁边3个领点有数字,则找一个有数字的点进行相减。(听上去会有点绕)

  • Firstly, if it possible it will satisfy the equation A + C + F + H = B + D + E + G.
  • Secondly, go into loop, if every position is 0 quit the loop.
  • Thirdly, find the maximum position to decrease/increase. If this maximum position doesn’t have adjacent position to decrease, than find another position with value (not 0), increase 1 to two adjacent position adjacent to the maximum position and another position. Else decrease 1 to maximum position and the position adjacent to it.

Timus #2025

题目说明:有n个人分成了k组,不同组的人两两对打,要求对打局数最大。

题目解析:每组约平均得出结果越大,sum过程纯属数学计算过程。

Problem Analysis English version: We can easily notice from math calculations that the more average of each group, the bigger number we will get.

Timus #1401

题目说明:给定一个起点,剩下的用L形的三个方块进行填充。

题目解析:迭代。最大的正方形切成四个小正方形,一步步切下去直到最后剩余2*2的小正方形。在大正方形正中间四个方块,除起点所在象限的方块,即另外三个方块标记上相同数字。

Title Analysis English version: We can using iteration to solve problems. From the start position, starting to binary cut the matrix into four pieces until every sub-matrix is 2*2.  I will mark the start position and the other three positions in the middle which has different quadrants besides the quadrant the start position in.

Timus #1005

题目说明:把全部石头分成两部分,使得两堆石头质量相差最小

题目解析:dp动态规划

因为本人不会/没写过动态规划,该代码实为CSDN上的代码,本人做法为全排列,算法复杂度太高,runtime error。

Timus #1296

题目解释:最大子序列的和

浙ICP备2021019730-1    浙公网安备 33010902002953号
Copyright © 2024 PanCake