首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >【周练】 求导

【周练】 求导

作者头像
FishWang
发布2025-08-26 19:04:21
发布2025-08-26 19:04:21
8700
代码可运行
举报
运行总次数:0
代码可运行

求导

Crawling in process... Crawling failed Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu

Description

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 by the black dotted lines. Then the card is folded along the magenta lines to make a box without a cover.

Given the width and height of the box, you will have to find the maximum volume of the box you can make for any value of x.

Input

Input starts with an integer T (≤ 10000), denoting the number of test cases.

Each case starts with a line containing two real numbers L and W (0 < L, W < 100).

Output

For each case, print the case number and the maximum volume of the box that can be made. Errors less than 10-6 will be ignored.

Sample Input

3

2 10

3.590 2.719

8.1991 7.189

Sample Output

Case 1: 4.513804324

Case 2: 2.2268848896

Case 3: 33.412886

水题没得说。

代码如下:

代码语言:javascript
代码运行次数:0
运行
复制
#include <stdio.h>
#include <math.h>
int main()
{
	int n;
	double l,w;
	double x;
	double cot;
	scanf ("%d",&n);
	int ans=1;
	while (n--)
	{
		scanf ("%lf%lf",&l,&w);
		x=((4*w+4*l)-sqrt((4*w+4*l)*(4*w+4*l)-48*w*l))/24;
		cot=4*x*x*x-(2*w+2*l)*x*x+w*l*x;
		printf ("Case %d: %.6lf\n",ans++,cot);
	}
	return 0;
}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2025-08-26,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档