一、题目回顾 题目链接:Square Problem Description Given a set of sticks of various lengths, is it possible to join them end-to-end to form a square? Input The fi ...
分类:
其他好文 时间:
2017-08-07 20:38:39
阅读次数:
161
题解:dp[ i ][ j ]=min { dp[ i ][ k ]+dp[ k ][ j ] }+a[ j ]-a [i ]。 和石子归并是一样的问题,枚举区间的长度,然后更新这个区间的值。 ...
分类:
其他好文 时间:
2017-08-07 15:20:37
阅读次数:
135
There is a pile of n wooden sticks. The length and weight of each stick are known in advance. The sticks are to be processed by a woodworking machine ...
分类:
其他好文 时间:
2017-08-05 00:24:56
阅读次数:
227
题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=944 题目大意: 给你一个长度为L的木条, 和N个切割点, 每次切割的代价是当前切割木条的长度 ...
分类:
其他好文 时间:
2017-08-03 20:24:07
阅读次数:
175
Description Description Stan has n sticks of various length. He throws them one at a time on the floor in a random way. After finishing throwing, Stan ...
分类:
其他好文 时间:
2017-08-03 11:21:16
阅读次数:
176
Given a set of sticks of various lengths, is it possible to join them end-to-end to form a square? InputThe first line of input contains N, the number ...
分类:
其他好文 时间:
2017-07-28 20:50:54
阅读次数:
148
Sasha and Sticks 题意:n根棍子,每次拿走k根,当不足k根的时候不能拿,输,判断先手能否赢 思路:(n/k)&1,直接判断能经行奇数次取木棍还是偶数 AC代码: ...
分类:
其他好文 时间:
2017-07-26 21:46:34
阅读次数:
172
It's one more school day now. Sasha doesn't like classes and is always bored at them. So, each day he invents some game and plays in it alone or with ...
分类:
其他好文 时间:
2017-07-25 19:37:55
阅读次数:
159
A、Sasha and Sticks 题意:有两个人,每次轮流从n个棒子中抽出k个,直到剩余不足k个棒子。Sasha先抽。如果Sasha抽取的多,则输出YES,否则输出NO。 思路:n/k为奇数时,Sasha获胜。 1 #include<iostream> 2 #include<cstdio> 3 ...
分类:
其他好文 时间:
2017-07-25 10:21:14
阅读次数:
166
题意:给你两个字符串a,b,不区分大小写,将b分成三段,重新拼接,问是否能得到A; 思路:暴力枚举两个断点,然后check的时候需要字符串hash,O(1)复杂度N*N; 题目链接:传送门 ...
分类:
其他好文 时间:
2017-07-24 22:35:36
阅读次数:
166