1137 - Expanding Rods
Time Limit: 0.5 second(s) Memory Limit: 32 MB

When a thin rod of length L is heated n degrees, it expands to a new length L' = (1+n*C)*L, where C is the coefficient of heat expansion.

When a thin rod is mounted on two solid walls and then heated, it expands and takes the shape of a circular segment, the original rod being the chord of the segment.

Your task is to compute the distance by which the center of the rod is displaced. That means you have to calculate h as in the picture.

Input

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

Each case contains three non-negative real numbers: the initial length of the rod in millimeters L, the temperature change in degrees n and the coefficient of heat expansion of the material C. Input data guarantee that no rod expands by more than one half of its original length. All the numbers will be between 0 and 1000 and there can be at most 5 digits after the decimal point.

Output

For each case, print the case number and the displacement of the center of the rod in single line. Errors less than 10-6 will be ignored.

Sample Input

Output for Sample Input

3

1000 100 0.0001

150 10 0.00006

10 0 0.001

Case 1: 61.3289915

Case 2: 2.2502024857

Case 3: 0


SPECIAL THANKS: JANE ALAM JAN (DESCRIPTION, SOLUTION, DATASET, PICTURES)

思路:L' = p*r ——p为弧度

r = (L/2)/sin(p/2)

然后公式可以化为 (2×L') /L=(p)/sin(p/2);

然后右边求导可知道右边随p单调增,然后二分p即可。

 1 #include<stdio.h>
2 #include<algorithm>
3 #include<iostream>
4 #include<string.h>
5 #include<queue>
6 #include<stack>
7 #include<set>
8 #include<math.h>
9 using namespace std;
10 typedef long long LL;
11 double pi=acos(-1);
12 int main(void)
13 {
14 int i,j,k;
15 scanf("%d",&k);
16 int s;
17 double L ,n,c;
18 for(s=1; s<=k; s++)
19 {
20 scanf("%lf %lf %lf",&L,&n,&c);
21 double l=0;
22 double r=2*pi;
23 int ans=0;
24 double ll=(1+n*c)*L;
25 while(ans<=100)
26 {
27 double mid=(l+r)/2;
28 double ac=2*ll*sin(1.0*mid/2);
29 double ak=L*mid;
30 if(ac>=ak)
31 {
32 l=mid;
33 }
34 else r=mid;
35 ans++;
36 }
37 double rr=(1.0*L/2)/(sin(1.0*r/2));
38 double hh=rr*cos(1.0*r/2);
39 double h=rr-hh;
40 printf("Case %d:",s);
41 printf(" %.6f\n",h);
42 }
43 return 0;
44 }

1137 - Expanding Rods的更多相关文章

  1. LightOJ 1137 - Expanding Rods 基础计算几何

    http://www.lightoj.com/volume_showproblem.php?problem=1137 题意:一根长度为L的杆热膨胀为L',左端点到右端点间距离不变,且膨胀后的杆的弧为圆 ...

  2. POJ 1905 Expanding Rods

                           Expanding Rods Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 1 ...

  3. Expanding Rods(二分POJ1905)

    Expanding Rods Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 13688   Accepted: 3527 D ...

  4. UVA 10668 - Expanding Rods(数学+二分)

    UVA 10668 - Expanding Rods 题目链接 题意:给定一个铁棒,如图中加热会变成一段圆弧,长度为L′=(1+nc)l,问这时和原来位置的高度之差 思路:画一下图能够非常easy推出 ...

  5. UVA 10668 Expanding Rods

    Problem A: Expanding Rods When a thin rod of length L is heated n degrees, it expands to a new lengt ...

  6. poj 1905 Expanding Rods(木杆的膨胀)【数学计算+二分枚举】

                                                                                                         ...

  7. POJ 1905:Expanding Rods 求函数的二分

    Expanding Rods Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 13780   Accepted: 3563 D ...

  8. D - Expanding Rods POJ - 1905(二分)

    D - Expanding Rods POJ - 1905 When a thin rod of length L is heated n degrees, it expands to a new l ...

  9. POJ 1905 Expanding Rods(二分)

    Expanding Rods Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 20224 Accepted: 5412 Descr ...

随机推荐

  1. 字符串String的trim()方法

    用来删除字符串两端的空白字符并返回,trim方法并不影响原来的字符串本身,它返回的是一个新的字符串 String a = "  Hello World  "; String b = ...

  2. 记一次 .NET 某化妆品 webapi 卡死分析

    一:背景 1. 讲故事 10月份星球里的一位老朋友找到我,说他们公司的程序在一个网红直播带货下给弄得无响应了,无响应期间有大量的 RabbitMQ 超时,寻求如何找到根源,聊天截图我就不发了. 既然无 ...

  3. 日常Java 2021/9/20

    Java随机数 运用Java的random函数实现猜数字游戏 随机产生一个1-50之间的数字,然后让玩家猜数,猜大猜小都给出提示,猜对后游戏停止 package pingchangceshi; imp ...

  4. 大数据学习day17------第三阶段-----scala05------1.Akka RPC通信案例改造和部署在多台机器上 2. 柯里化方法 3. 隐式转换 4 scala的泛型

    1.Akka RPC通信案例改造和部署在多台机器上  1.1 Akka RPC通信案例的改造(主要是把一些参数不写是) Master package com._51doit.akka.rpc impo ...

  5. 零基础学习java------day1------计算机基础以及java的一些简单了解

    一. java的简单了解 Java是一门面向对象编程语言,不仅吸收了C++的各种优点,还摒弃了C++里难以理解的多继承.指针等概念,因此Java语言具有功能强大和简单易用两个特征.Java语言作为静态 ...

  6. vue中vuex的五个属性和基本用法

    VueX 是一个专门为 Vue.js 应用设计的状态管理构架,统一管理和维护各个vue组件的可变化状态(你可以理解成 vue 组件里的某些 data ). Vuex有五个核心概念: state, ge ...

  7. 【Linux】【Services】【DNS】使用Bind搭建DNS服务

    1. 简介 1.1. 实现的功能:DNS解析以及智能转发 1.2. 官方文档: 1.3. 基础概念:http://www.cnblogs.com/demonzk/p/6494968.html 2. 环 ...

  8. Win10 Chrome 在DPI缩放下导致界面放大问题 解决方案

    支持:54.0.2840.59 m (64-bit) 以下大多数版本,具体未测试.如有问题可以反馈一下. 方法1:为程序设置"高DPI设置时禁用显示缩放. 方法2:为程序添加启动参数: /h ...

  9. 『与善仁』Appium基础 — 24、等待activity出现

    目录 1.什么是等待activity出现 2.wait_activity()方法 3.获取当前页面的activity方法 4.综合练习 1.什么是等待activity出现 在启动APP的时候,要配置包 ...

  10. Redis监控参数

    目录 一.客户端 二.服务端 一.客户端 127.0.0.1:6379> info stats #Redis自启动以来处理的客户端连接数总数 total_connections_received ...