题意: 给一棵树,先手可以任意选一个点染色,接下来每个人可以将当前点的一个祖先或一个孩子染色,一个点只能被染色一次,谁无点可以染色谁就输了。 解法 对于一个点,可以到达的点有所有祖先和所有孩子。如果u可以到达v节点,那么v节点显然也可以到达u节点。 此时我们可以考虑将树上博弈转化成图。n个节点,每个 ...
分类:
其他好文 时间:
2020-04-02 10:34:45
阅读次数:
312
今天遇到一道DP题,记录一下思路,以免遗忘。 题目:地下城游戏 题目来源:https://leetcode-cn.com/problems/dungeon-game/ 一些恶魔抓住了公主(P)并将她关在了地下城的右下角。地下城是由 M x N 个房间组成的二维网格。我们英勇的骑士(K)最初被安置在左 ...
分类:
其他好文 时间:
2020-03-31 21:13:10
阅读次数:
106
解法一: 由题意可知对于每一个位置,只要能走到一个先手必输的位置,则先手必赢;已知0为先手必输位置,遍历1-n,依次确定;时间复杂度为o(TN) , 空间复杂度o(N).MLE,TLE , 所以做题不仅要关注时间复杂度,还要关注空间复杂度; #include<bits/stdc++.h> using ...
分类:
其他好文 时间:
2020-03-31 12:32:27
阅读次数:
54
1)NGUI与新版Prefab系统冲突问题2)关于HUD的问题3)RawImage设置DefaultHDR格式的RenderTexture后颜色异常4)Unity如何烘焙透贴阴影做出真实影子5)iOS下打包AssetBundle出现错误 NGUI Q:Unity 2018.4.0,NGUI的预设物点 ...
分类:
其他好文 时间:
2020-03-30 21:47:29
阅读次数:
95
Basketball Reference.com 数据源地址 http://labfile.oss.aliyuncs.com/courses/782/data.zip数据下载地址 用到的三张表 Team Per Game Stats Opponent Per Game Stats Miscellan ...
分类:
编程语言 时间:
2020-03-29 12:46:58
阅读次数:
106
Problem Statement Snuke has decided to play a game using cards. He has a deck consisting of NN cards. On the ii -th card from the top, an integer AiAi ...
分类:
其他好文 时间:
2020-03-29 01:37:30
阅读次数:
90
914. 翻转游戏 中文English You are playing the following Flip Game with your friend: Given a string that contains only two characters: + and -, you can flip ...
分类:
其他好文 时间:
2020-03-26 01:06:15
阅读次数:
79
A. Sum of Odd Integers 首先可以算出从1开始到第k个奇数之和。如果和大于n,则不可能存在k个奇数加和等于n,否则用n减去前k个奇数的和,这个差值若是偶数,直接加到最大的奇数上,就可以满足题意要求,否则输出no。 1 #include<bits/stdc++.h> 2 using ...
分类:
其他好文 时间:
2020-03-26 01:02:17
阅读次数:
72
class Game(object): top_score = 0 # 类属性 def __init__(self, name): self.name = name # 实例属性 @staticmethod def show_help(): # 静态方法 print('帮助信息:。。。') @cla ...
分类:
其他好文 时间:
2020-03-25 13:28:07
阅读次数:
52
Petya has a rectangular Board of size n×mn×m . Initially, kk chips are placed on the board, ii -th chip is located in the cell at the intersection of ...
分类:
其他好文 时间:
2020-03-25 01:05:14
阅读次数:
81