Little Zu Chongzhi's Triangles Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 2515    Accepted Submission(s): 1427 Problem Description Zu Chongzhi (429–500) was a prominent Chinese mathematic…
周六周末组队训练赛. Dogs' Candies Time Limit: 30000/30000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 3920    Accepted Submission(s): 941 Problem Description Far far away, there live a lot of dogs in the forest. Unlike…
Song Jiang's rank list Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 2006    Accepted Submission(s): 1128 Problem Description <Shui Hu Zhuan>,also <Water Margin>was written by Shi Nai…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5135 题目大意:给你n条边,选出若干条边,组成若干个三角形,使得面积和最大.输出最大的面积和. 先将边从小到大排序,这样前面的两条边加起来如果不大于第三条边就可以跳出,这是一个存在性条件. dfs(int idx,int now,int cnt,int nowmax)代表我当前处理的是第idx条边,已经加入边集的有cnt条边,当前的边的长度和为now,组成的最大面积和为nowmax. 暴力枚举每个三…
http://acm.hdu.edu.cn/showproblem.php?pid=5135 题意:给你N个木棍的长度,然后让你组成三角形,问你组成的三角形的和最大是多少? 思路:先求出可以组成的所有的三角形,然后状压dp就可以.求所有的三角形也可以用状压,也可以三重循环求. #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #define maxn 1<…
A Curious Matt Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 3058    Accepted Submission(s): 1716 Problem Description There is a curious man called Matt. One day, Matt's best friend Ted is w…
Little Zu Chongzhi's Triangles Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 743    Accepted Submission(s): 399 Problem Description Zu Chongzhi (429–500) was a prominent Chinese mathematicia…
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others) Total Submission(s): 1165    Accepted Submission(s): 655 Problem Description Zu Chongzhi (429–500) was a prominent Chinese mathematician and astronomer during the L…
https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5089 题目大意:给n个木棒,用这n个木棒组成多个三角形,求这些三角形面积和的最大值,如果一个三角也不能组成则输出0.00 (注意:一根木棒就可以当做一条边,刚开始就错误的以为一条边可以由很多木棒共同组成而将题想复杂了) 分析: 将这n个木棒按长度从大到小排(从小到大票排是错误…
这个题--我上来就给读错了,我以为最后是一个三角形,一条边可以由多个小棒组成,所以想到了状态压缩各种各样的东西,最后成功了--结果发现样例过不了,三条黑线就在我的脑袋上挂着,改正了以后我发现N非常小,想到了回溯每个棍的分组,最多分5组,结果发现超时了--最大是5^12 =  244,140,625,厉害呢-- 后来想贪心,首先想暴力出所有可能的组合,结果发现替换问题是一个难题--最后T T ,我就断片了.. 等看了别人的办法以后,我才发现我忽视了三角形的特性,和把数据排序以后的特点. 如果数据从…
Song Jiang's rank list Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 2006    Accepted Submission(s): 1128 Problem Description <Shui Hu Zhuan>,also <Water Margin>was written by Shi Nai…
题目传送门 题意:有n根木棍,三根可能能够构成三角形,选出最多的三角形,问最大面积 分析:看到这个数据范围应该想到状压DP,这次我想到了.0010101的状态中,1表示第i根木棍选择,0表示没选,每一次三根木棍累加转移方程.虽说很简单,但是能自己独立敲出来还是很开心的,AC的快感! /************************************************ * Author :Running_Time * Created Time :2015/10/14 星期三 13:4…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5113 题目大意:有k种颜色的方块,每种颜色有ai个, 现在有n*m的矩阵, 问这k种颜色的方块能否使任意两个相连的方块颜色不一样填满整个矩阵,如果可以输出任意一种. 解题思路:由于n,m在[1, 5]内, 所以直接暴力枚举: 需要注意的是:需要剪枝一下. 代码如下: #include<stdio.h> #include<string.h> #include<cmath> #…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5115 题目大意:前面有n头狼并列排成一排, 每一头狼都有两个属性--基础攻击力和buff加成, 每一头狼的攻击力等于他自身的基础攻击力加上旁边狼对他的buff加成. 现在你被这群狼围着了, 必须将这些狼全部击败, 你才能逃出, 你每攻击一头狼,收到的伤害是狼的总攻击力.现在问,你逃出这些狼的围攻需要的最小代价(收到的伤害): 解题思路:声明dp数组, dp[i][j]代表从i到j的区间杀死所有狼的最…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5954 Problem DescriptionYou have got a cylindrical cup. Its bottom diameter is 2 units and its height is 2 units as well.The height of liquid level in the cup is d (0 ≤ d ≤ 2). When you incline the cup t…
传送门 对于错想成lis的解法,提供一组反例 1 3 4 2 5同时对于这次案例也可以观察出解法:对于每一个数,如果存在比它小的数在它后面,它势必需要移动,因为只能小的数无法向右移动,而且每一次移动都必然可以使得这个数到达正确位置,这是根据题意而得的 #include<queue> #include<cmath> #include<cstdio> #include<cstring> #include<cstdlib> #include<io…
题目传送门 设dp[i][j]为杀掉区间i到j之间的狼需要付出的最小代价,那么dp[i][j]=min{dp[i][k-1]+dp[k+1][j]+a[k]+b[i-1]+b[j+1]} Java代码 import java.io.*; import java.util.*; class MyInputStream extends InputStream { public BufferedInputStream bis = new BufferedInputStream(System.in);…
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=5558 Problem Description Alice wants to send a classified message to Bob. She tries to encrypt the message with her original encryption method. The message is a string S, which consists of Nlowercase let…
Recursive sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 249    Accepted Submission(s): 140 Problem Description Farmer John likes to play mathematics games with his N cows. Recently, t…
Counting Cliques Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 539    Accepted Submission(s): 204 Problem Description A clique is a complete graph, in which there is an edge between every pair…
Thickest Burger Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 63    Accepted Submission(s): 60 Problem Description ACM ICPC is launching a thick burger. The thickness (or the height) of a piec…
Relative atomic mass Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 66    Accepted Submission(s): 59 Problem Description Relative atomic mass is a dimensionless physical quantity, the ratio of…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4818 深深地补一个坑~~~ 现场赛坑在这题了,TAT.... 今天把代码改了下,过掉了,TAT 很明显的高斯消元的模型. 现场一开始想的也大概是对的. 根据度可以得到n个方程,加起来为1是一个方程,有一个是多余的. 加起来就是n个方程. 只可能是无穷解和唯一解的情况. 现场是先求解一遍,然后枚举所有可以加的,不停做高斯消元. 但是因为高斯消元是O(n^3) 的, 再枚举的话就是n^4了.... 这样…
Detachment Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 570    Accepted Submission(s): 192 Problem Description In a highly developed alien society, the habitats are almost infinite dimensiona…
Convex Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 294    Accepted Submission(s): 220 Problem Description We have a special convex that all points have the same distance to origin point.As y…
Reincarnation Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 843    Accepted Submission(s): 283 Problem Description Now you are back,and have a task to do:Given you a string s consist of lower…
排序 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 30009    Accepted Submission(s): 8326 Problem Description 输入一行数字,如果我们把这行数字中的‘5’都看成空格,那么就得到一行用空格分割的若干非负整数(可能有些整数以‘0’开头,这些头部的‘0’应该被忽略掉,除非这个整数就是由若…
题目 字符串处理 题意要猜,解析见代码: /* 这题每个S(n)是描述S(n-1)值 例如: S(1)=1; S(2)=11;即描述S(1)有1个1=11 S(3)=21;即描述S(2)有2个1=21 S(4)=1211;即描述S(3)有1个2和2个1=1211 .... */ #include <cstdio> #include<iostream> #include <cstring> #include <algorithm> using namespac…
题目链接 Problem Description The Eternal Fleet was built many centuries ago before the time of Valkorion by an unknown race on the planet of Iokath. The fate of the Fleet's builders is unknown but their legacy would live on. Its first known action was in…
Count the string Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4105    Accepted Submission(s): 1904 Problem Description It is well known that AekdyCoin is good at string problems as well as nu…