题目链接:点击打开链接

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 - 1cuts 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.

数学知识,还好我还记得。就是相似三角形,知道面积比,求高。因为大三角形的高已知,所以小三角形的高很容易算出,i从1到n-1,高正好完成排序。

代码实现:

#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdio>using namespace std;int main()
{long long n,h,i;double a[1005];while(scanf("%d%d",&n,&h)!=EOF){for(i=1;i<n;i++){a[i]=sqrt(i/(n*1.0))*h;}printf("%.12llf",a[1]);for(i=2;i<n;i++){printf(" %.12llf",a[i]);}printf("\n");}return 0;
}

codeforce B. Cutting Carrot相关推荐

  1. CF - 794B. Cutting Carrot - 数学

    1.题目描述: B. Cutting Carrot time limit per test 2 seconds memory limit per test 256 megabytes input st ...

  2. 【codeforces 794B】Cutting Carrot

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

  3. 小白题解 Codeforces 794B Cutting Carrot

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

  4. Codeforces Round #300 A. Cutting Banner 水题

    A. Cutting Banner Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/538/pro ...

  5. UVA10003 切木棍 Cutting Sticks(区间DP、细节)

    整理的算法模板合集: ACM模板 本题其实就是一个区间DP 的模板题,总长度为len,有n个切割点,也就是说能被切割成n+1段,所以左边界是0,有边界是n + 1,所以答案就是f[0][n + 1]. ...

  6. Hadoop十岁!Doug Cutting成长史+他眼中大数据技术的未来

    上次见到(膜拜)Hadoop之父Doug Cutting是在2年前,2014中国大数据技术大会上.今年Hadoop10岁,刚看到他的Hadoop十周年贺词,感觉时间飞逝.最近CSDN和InfoQ都在制 ...

  7. 贪心 Codeforces Round #300 A Cutting Banner

    题目传送门 1 /* 2 贪心水题:首先,最少的个数为n最大的一位数字mx,因为需要用1累加得到mx, 3 接下来mx次循环,若是0,输出0:若是1,输出1,s[j]--: 4 注意:之前的0的要忽略 ...

  8. Hadoop之父Doug Cutting

    生活中,可能所有人都间接用过他的作品,他是Lucene.Nutch .Hadoop等项目的发起人.是他,把高深莫测的搜索技术形成产品,贡献给普罗大众:还是他,打造了目前在云计算和大数据领域里如日中天的 ...

  9. Cutting Sticks UVA - 10003

    题解:dp[ i ][ j ]=min { dp[ i ][ k ]+dp[ k ][ j ] }+a[ j ]-a [i ]. 和石子归并是一样的问题,枚举区间的长度,然后更新这个区间的值. 1 # ...

最新文章

  1. 《圣殿祭司的ASP.NET4.0专家技术手册》---- 1-13 ClientBuilderManager类别的编译功能...
  2. Windows 7删需要权限的文件
  3. app.vue里使用data_Yeoman自定义Generator使用案例及Plop的使用
  4. MYSQL和ORACLE时区设置比较
  5. sqlserver 中统计信息语句
  6. delphi 遍历所有文件夹
  7. 直播 | ACL 2021论文解读:为结构预测问题自动寻找更强的词嵌入拼接方式
  8. 一种巧妙且简单的数据增强方法 - MixUp 小综述
  9. 管理感悟:计划是给谁看的
  10. 告诉你一个真实的数字化
  11. 良心安利陶瓷材质贴图素材网站
  12. 地震了,地震了!!!
  13. 【案例练习】17个华丽的UI效果的实现 ,激发你的创造灵感
  14. 转换工具推荐:如何将PDF文档转换为PPT演示文稿
  15. ubuntu快捷键备忘
  16. 软件测试面试问题汇总
  17. No MyBatis mapper was found in '[com.briup.demo]' package. Please check your
  18. 一些通用 编程变量 单词(常用变量名;持续更新...)
  19. **Multisim中如何测量时序**急!急!急!急!急!
  20. IDEA2020版导入tomcat的jar包到eternal libraries时遇到的问题

热门文章

  1. Python个人项目1 --------电商项目
  2. 让你的网页,点哪都是小心心~~~
  3. 计算机基础——无处不网络(2)
  4. DirectShow 09 - 音视频捕捉
  5. swf 文件 打包 exe 方法
  6. 【中英双语】Linux黑客教程从初学者到高级!
  7. 内推网创始人黄小亮:拒绝猎头的P2P招聘
  8. DEV gridcontrol 汉化类
  9. 使用TextPad一键编译运行C++程序和JAVA程序
  10. e5408fc4a618ed2a663d0306def2cec3 (学生实验,谢谢)