1.题目描述:

B. Cutting Carrot
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally, and thus he wants to cut the carrot into n pieces of equal area.

Formally, the carrot can be viewed as an isosceles triangle with base length equal to 1 and height equal to h. Igor wants to make n - 1 cuts parallel to the base to cut the carrot into n pieces. He wants to make sure that all n pieces have the same area. Can you help Igor determine where to cut the carrot so that each piece have equal area?

Illustration to the first example.

Input

The first and only line of input contains two space-separated integers, n and h (2 ≤ n ≤ 1000, 1 ≤ h ≤ 105).

Output

The output should contain n - 1 real numbers x1, x2, ..., xn - 1. The number xi denotes that the i-th cut must be made xi units away from the apex of the carrot. In addition, 0 < x1 < x2 < ... < xn - 1 < h must hold.

Your output will be considered correct if absolute or relative error of every number in your output doesn't exceed 10 - 6.

Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .

Examples
input
3 2

output
1.154700538379 1.632993161855

input
2 100000

output
70710.678118654752

Note

Definition of isosceles triangle: https://en.wikipedia.org/wiki/Isosceles_triangle.

2.题意概述:

给你一个等腰三角形,要你用n-1条垂直于高的直线将它们分成n等份,问这些直线的坐标。

3.解题思路:

既然是n等份,即每份的面积为总面积的1/n,因为三角形更好算,考虑从上往下分,前i份组成的三角形所占面积为i/n,即Si/Sn=i/n。

而由相似三角形容易得Si/Sn=Xi^2/n^2,那么再利用三角形面积公式就出来了。

PS:开始没想到那个相似三角形公式,而是推了一遍带tan的数,可能是爆精度了,样例都没过QAQ

4.AC代码:

#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define maxn 100100
#define lson root << 1
#define rson root << 1 | 1
#define lent (t[root].r - t[root].l + 1)
#define lenl (t[lson].r - t[lson].l + 1)
#define lenr (t[rson].r - t[rson].l + 1)
#define N 1111
#define eps 1e-6
#define pi acos(-1.0)
#define e exp(1.0)
using namespace std;
const int mod = 1e9 + 7;
typedef long long ll;
typedef unsigned long long ull;
double n, h;
double ans[1001];
int main()
{#ifndef ONLINE_JUDGEfreopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);long _begin_time = clock();
#endifint a,b;while (~scanf("%d%d", &a, &b)){for (int i = 1; i < a; i++){double temp = i;if (i == 1)printf("%.10f", b*sqrt(temp / a));elseprintf(" %.10f", b*sqrt(temp / a));}puts("");}
#ifndef ONLINE_JUDGElong _end_time = clock();printf("time = %ld ms.", _end_time - _begin_time);
#endifreturn 0;
}

CF - 794B. Cutting Carrot - 数学相关推荐

  1. 小白题解 Codeforces 794B Cutting Carrot

    (水题)题目链接:点击打开链接 题目大意:给定一个三角形,底始终为1,高h,用平行于底边的线将它分成面积相等的n份,分别求第i份的底边到大三角形定点的距离. 分析:设第i份对应高为Y,由每份面积相等可 ...

  2. 【codeforces 794B】Cutting Carrot

    [题目链接]:http://codeforces.com/contest/794/problem/B [题意] 给你一个等腰三角形; 它的底边为1; 高为h; 要求你把这个等腰三角形分成n份面积相等的 ...

  3. codeforce B. Cutting Carrot

    题目链接:点击打开链接 Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thu ...

  4. 【日程训练】算法脱贫计划

    算法脱贫计划 前言 2020-12-26 2020-12-27 2020-12-28 ~ 2020-1-1 2021-1-1 ~ 2021-1-16 [寒假训练计划]2021-1-17 ~ 2021- ...

  5. 第五讲 三角形的五心

    第五讲 三角形的五心 三角形的外心.重心.垂心.内心及旁心,统称为三角形的五心. 一.外心. 三角形外接圆的圆心,简称外心.与外心关系密切的有圆心角定理和圆周角定理. 例1.过等腰△ABC底边BC上一 ...

  6. CF 990A. Commentary Boxes【数学/模拟】

    [链接]:CF [题意]:对于一个数n,每次加一的代价是a,每次减一的代价是b,求被m整除时的最小代价. [分析]:分情况讨论,自己多举几个栗子. [代码]: #include<cstdio&g ...

  7. CF思维联系–CodeForces - 222 C Reducing Fractions(数学+有技巧的枚举)

    ACM思维题训练集合 To confuse the opponents, the Galactic Empire represents fractions in an unusual format. ...

  8. cf:B. Patchouli‘s Magical Talisman【数学贪心思维 + 奇偶分析】

    分析 给出一堆数 可以通过相加或除2让它们全部变成奇数 如果全奇数返回0 由于奇数 + 偶数 = 奇数 所以只要有一个奇数就能把偶数和它相加不停的变成奇数 所以只要存在奇数,就可以返回偶数的个数 否则 ...

  9. 板刷CF:数学1500-2100

    1.1542C 题目链接:题目链接 分析: 1.1542C,对于一个数n我们要求其最小的不能整除他的数,我们需要从1开始逐一枚举,显然这样数量级是很大的,所以我们需要想其他的解决办法,那么我们对小数据 ...

最新文章

  1. 如何终止正在在发送的ajax请求
  2. 《Python知识手册》,V3.0版来了,2021年,走起!
  3. Worktile荣登2020中关村国际前沿科技创新大赛大数据与云计算领域TOP10
  4. ubuntu 安装 lamp 环境
  5. tomcat安装与项目部署
  6. HTML基础(格式标签)
  7. linux 安装wdcp控制面板
  8. 1.13 编程基础之综合应用 10 判决素数个数 python
  9. Nginx学习之七-模块ngx_epoll_module详解(epoll机制在nginx中的实现)
  10. 《老马的职业“鬼”话》 马华兴著
  11. UTF-8 编码里,一个汉字占用多少个字节 -转
  12. opencv使用trackbar调控美颜程度
  13. 家庭生涯妙招,必定要看哦
  14. windows日趋苹果化?win11到Win12,妥妥MacOS的复刻版
  15. 网站死链接检测查询工具
  16. cmd 新增dns_cmd修改DNS,以及DNS大全
  17. Qt基础之二十:进程间通信
  18. 专访北邮教授孙松林:5G尚处第一阶段 中国定会独领风骚
  19. 奔驰甩掉拖油瓶smart,吉利接盘?
  20. cmd /c和cmd /k和cmd

热门文章

  1. python画箭头_箭头指南 | Matplotlib 中文
  2. 计算机无法读取内存,图文教你如何修复电脑无法识别读取的U盘(SD卡)!-内存卡在电脑上读不出来怎么办...
  3. com.netflix.client.ClientException: load balancer doer not hava available server for client: XXX 的报错
  4. esp32的python教程步数采集_ESP32CAM micropython的操作指南
  5. 摄像头poe供电原理_POE交换机、POE分离器供电原理及注意问题
  6. mysql建库1044_Mysql创建数据库时提示Error 1044
  7. 人类简史 10 金钱的味道
  8. 低压差线性稳压器简介
  9. MySQL 查询一个表的大小
  10. maven 常用命令goal