由于顺序是可以改变的. 所以考虑是否可以映射.只要存在字母对应出现的次数都相同.那么就可以通过映射得到. 具体是开一个数组记录每个字母出现的次数… 然后sort
Rabbit and Grass # **Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3058 Accepted Submission(s): 2261 **
hdu 2149题目链接
题意&思路:巴什博奕,点m是n点。。。然后往前画即可。。。
题目链接:hdu 2188题目链接
题意&思路:巴什博奕。。画n点p点。。。
**序:**博弈是信息学和数学试题中常会出现的一种类型,算法灵活多变是其最大特点,而其中有一类试题更是完全无法用常见的博弈树来进行解答。 寻找必败态即为针对此类试题给出一种解题思路。
给6个矩形的长和宽(或者宽和长),问这六个矩形能否组成一个长方体.
比赛的时候没过.还以为是树状数组写残了. 但实际上是有自己不知道的东西. 这种博弈叫 nim游戏 所以这是一个二维的nim游戏. **nim游戏的性质是xor 和为0必败,否则必胜. xor和也有前缀和性质,所以可以用树状数组维护.
假设有n堆石子,每堆石子的个数分别如下
a1, a2, a3, … an
定义nim-sum为a1^a2^a3…an
果然dp還是弱項啊啊啊啊.. 不過比最開始的完全無從下手強了不少應該...
贪心..尽量把一样的材料放在一起... 然后写蠢了..妈蛋... 详情见代码
x的二进制表示中1的个数即为答案.
原因是,每天晚上糖果数量翻倍,相当于左移1位,这时候二进制表示中1的数量不变
初识分快.
引一段题解:
Let’s split rectangle 106 × 106 by vertical lines into 1000 rectangles 103 × 106. Let’s number them from left to right. We’re going to pass through points rectangle by rectangle. Inside the rectangle we’re going to pass the points in increasing order of y-coordinate if the number of rectangle is even and in decreasing if it’s odd.
因为每一个正整数可以唯一分解质因数…
要看能猜多少次,只要知道不大于n的质因子数有多少个即可(相同的算多
背包还是理解的不够透彻..
因为每次都是用那个一维形式的.
这道题的做法类似01背包.
A. Multiplication Table
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Let’s consider a table consisting of n rows and n columns. The cell located at the intersection of i-th row and j-th column contains number i × j. The rows and columns are numbered starting from 1.
其实不应该在博客上写这种心情流的东西。。。。。。
显得好矫情啊。。。。。