lightoj 1297(三分)】的更多相关文章

传送门:Largest Box 题意:长度为L宽度为W的纸四个角去掉x*x的正方形,然后形成一个长方体,问能组成长方体的最大体积为多少. 分析:三分x求最值. #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #define N 100010 #define mod 1000000007 #define LL long long #define lson l,…
题目链接:https://vjudge.net/contest/28079#problem/K 题目大意:给你一个长为L,宽为W的纸片,四个角剪掉边长为x的正方形,如下图所示,然后折成一个无盖的纸盒,求纸盒最大体积. 解题思路:我们可以知道体积V(x)=(L-2*x)*(W-2*x)*x求导得到f(x)=12x^2-4*(L+W)*x^2+L*W,V(x)的图像如下所示 所以我们知道极大值点是f(x)两个(或一个)零点中x值较小的那个点,可以通过求根公式求得. 代码: #include<iost…
链接: https://vjudge.net/problem/LightOJ-1297 题意: In the following figure you can see a rectangular card. The width of the card is W and length of the card is L and thickness is zero. Four (x*x) squares are cut from the four corners of the card shown b…
1297 - Largest Box   PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB In the following figure you can see a rectangular card. The width of the card is W and length of the card is L and thickness is zero. Four (x*x) squares a…
Error Curves Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 4928    Accepted Submission(s): 1867 Problem Description Josephina is a clever girl and addicted to Machine Learning recently. Shepay…
http://lightoj.com/volume_showproblem.php?problem=1422 做的第一道区间DP的题目,试水. 参考解题报告: http://www.cnblogs.com/ziyi--caolu/p/3236035.html http://blog.csdn.net/hcbbt/article/details/15478095 dp[i][j]为第i天到第j天要穿的最少衣服,考虑第i天,如果后面的[i+1, j]天的衣服不要管,那么dp[i][j] = dp[i…
在一个2维平面上有两条传送带,每一条传送带可以看成是一条线段.两条传送带分别为线段AB和线段CD.lxhgww在AB上的移动速度为P,在CD上的移动速度为Q,在平面上的移动速度R.现在lxhgww想从A点走到D点,他想知道最少需要走多长时间 Input输入数据第一行是4个整数,表示A和B的坐标,分别为Ax,Ay,Bx,By 第二行是4个整数,表示C和D的坐标,分别为Cx,Cy,Dx,Dy 第三行是3个整数,分别是P,Q,ROutput输出数据为一行,表示lxhgww从A点走到D点的最短时间,保留…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4717 思路:三分时间求极小值. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> using namespace std; const int MAX_N = (300 + 30); const double e…
Turn the corner Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3070    Accepted Submission(s): 1232 Problem Description Mr. West bought a new car! So he is travelling around the city.One day he…
题目链接:http://lightoj.com/volume_showproblem.php?problem=1298 题意:给你两个数 n, p,表示一个数是由前 k 个素数组成的,共有 n 个素数,然后求这样的所有的数的欧拉和: 例如 n = 3, p=2; 前两个素数是2,3, 然后因为n=3,所以要再选一个素数组成一个数,有两种选择2*3*2=12 和 2*3*3=18 结果就是Φ(12)+Φ(18) = 10; 我们可以用dp[i][j] 表示前 j 个素数中选择 i 个的结果,Φ[n…