HDU 6616 Divide the Stones】的更多相关文章

目录 题面 中文题意 比赛惨状 我的走不通的思路 \(m\)是偶数的情况 \(m\)是奇数的情况 题解的思路 另一些思路 源代码 题面 Time limit 3000 ms Memory limit 131072 kB Special judge Yes OS Windows 中文题意 把\(n\)块石头分成\(k\)堆,要求每堆石头的重量之和相等.输出是否可以实现要求.如果可以实现,还要输出每堆石头里每一块石头的重量 比赛惨状 赛场上看见的第一反应--dp?不会.然后就先扔给有点思路队友,写另…
p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-size: 10.5000pt } h1 { margin-top: 5.0000pt; margin-bottom: 5.0000pt; text-align: center; font-family: 宋体; color: rgb(26,92,200); font-weight: bold; fo…
题意: 给你重量分别为1到n的n个石头,让你分成重量相等,数量也相等的k组,保证k是n的约数.问你能不能分配,如果能,输出具体的分配方案. 题解: 首先,如果1到n之和不能整除k,那么一定不能如题意分配. 否则一定能. 设m=n/k.m是每组分到的石头块数.我们把n块石头排成这样m*k的矩阵,假设12块石头,分成3组. $\begin{bmatrix}(1) & 2 & 3\\ (4) & 5 & 6\\ 7 & 8 & (9)\\ 10 &11 …
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4573 Problem Description Remember our childhood? A few naked children throw stones standing on the same position, the one throws farther win the game. Aha, of course, there are some naughty boys who care…
Divide the Sequence 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5783 Description Alice has a sequence A, She wants to split A into as much as possible continuous subsequences, satisfying that for each subsequence, every its prefix sum is not smal…
Divide the Sequence 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5783 Description Alice has a sequence A, She wants to split A into as much as possible continuous subsequences, satisfying that for each subsequence, every its prefix sum is not smal…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6616 题意是说n个数分别为1-n,将n个数分成k堆,能否满足每堆个数相等,数值之和相等.保证n%k=0. 构造题神马的太烦了略略略 我的构造方式是这样的,先判断每堆的个数,然后分奇偶讨论一下 每堆个数为偶时: 可以将n个数分成n/2对,如n为12时,分成1-12,2-11,3-10,4-9,5-8,6-7这样. 然后根据每堆的个数将n/2对分别放入每堆中. 如n=12,k=3时: 第一堆为1-12,…
Divide the Sequence Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 649    Accepted Submission(s): 331 Problem Description Alice has a sequence A, She wants to split A into as much as possible c…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5783 题目大意: 把一个N个数的数列拆成若干段,保证每一段的前缀和都非负,求最多能拆成多少段. 题目思路: [贪心] 一开始题目看错了看成每一段内和非负..DPWA了好久. 默认答案是n,从后往前找负数,找到一个负数就一直把它往前合并直到和值非负,这样这个区间的前缀和就一定非负,扣除合并的区间大小即可. // //by coolxxx //#include<bits/stdc++.h> #inc…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4751 题目大意:判断一堆人能否分成两组,组内人都互相认识. 解题思路:如果两个人不是相互认识,该两人之间连边.最终构成一张图,二分匹配. #include<cstdio> #include<cstring> #include<iostream> using namespace std; #define maxn 105 #define maxm 20010 int n,e;…