【codeforces 794B】Cutting Carrot
【题目链接】:http://codeforces.com/contest/794/problem/B
【题意】
给你一个等腰三角形;
它的底边为1;
高为h;
要求你把这个等腰三角形分成n份面积相等的部分;
而且是用平行于底面的横线分的;
让你求出这n-1条横线的位置在哪里;
【题解】
数学;
从上往下推;
容易得到高的公式;
【Number Of WA】
0
【完整代码】
#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ms(x,y) memset(x,y,sizeof x)
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 110;
int n,h;
double s;
int main()
{
//freopen("F:\\rush.txt","r",stdin);
ios::sync_with_stdio(false),cin.tie(0);//scanf,puts,printf not use
//init??????
cin >> n >> h;
s = 0.5*h;
s/=2.0;
double t = n;
s/=t;
rep1(i,1,n-1)
{
double is = i*s;
cout <<fixed<<setprecision(11)<<2*sqrt(h*is)<<' ';
}
return 0;
}
【codeforces 794B】Cutting Carrot的更多相关文章
- 【codeforces 415D】Mashmokh and ACM(普通dp)
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...
- 【codeforces 799A】Carrot Cakes
[题目链接]:http://codeforces.com/contest/799/problem/A [题意] 你有一个烤炉; 每t秒能同时烤出k个蛋糕; 你可以在第一个烤炉在烤的时候;同时花费d秒建 ...
- 【27.85%】【codeforces 743D】Chloe and pleasant prizes
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- 【codeforces 707E】Garlands
[题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...
- 【codeforces 707C】Pythagorean Triples
[题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...
- 【codeforces 709D】Recover the String
[题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出 ...
- 【codeforces 709B】Checkpoints
[题目链接]:http://codeforces.com/contest/709/problem/B [题意] 让你从起点开始走过n-1个点(至少n-1个) 问你最少走多远; [题解] 肯定不多走啊; ...
- 【codeforces 709C】Letters Cyclic Shift
[题目链接]:http://codeforces.com/contest/709/problem/C [题意] 让你改变一个字符串的子集(连续的一段); ->这一段的每个字符的字母都变成之前的一 ...
- 【Codeforces 429D】 Tricky Function
[题目链接] http://codeforces.com/problemset/problem/429/D [算法] 令Si = A1 + A2 + ... + Ai(A的前缀和) 则g(i,j) = ...
随机推荐
- TCP协议和UDP协议
一:TCP(Transmission Control Protocol) 传输控制协议 TCP是主机对主机层的传输控制协议,提供可靠的连接服务,采用三次握手确认建立一个连接: 第一次握手:主机A发送 ...
- jQuery选择器练习中,带空格和不带空格的问题
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- hdu 1868 水
#include<stdio.h> int main() { int n,m,i,j,k; while(scanf("%d",&n)!=EOF) { k=2; ...
- Elasticsearch---基于scroll技术滚动搜索大量数据
如果一次性要查出来比如10万条数据,那么性能会很差,此时一般会采取用scoll滚动查询,一批一批的查,直到所有数据都查询完处理完 使用scoll滚动搜索,可以先搜索一批数据,然后下次再搜索一批数据,以 ...
- js sort根据数值大小自动排序(转)
var arrDemo = new Array(); arrDemo[0] = 10; arrDemo[1] = 50; arrDemo[2] = 51; arrDemo[3] = 100; arrD ...
- 写一个函数,输入int型,返回整数逆序后的字符串
刚刚看到一个面试题:写一个函数,输入int型,返回整数逆序后的字符串.如:输入123,返回"321". 要求必须用递归,不能用全局变量,输入必须是一个參数.必须返回字符串.&quo ...
- POJ - 3257 Cow Roller Coaster (背包)
题目大意:要用N种材料建一条长为L的路,如今给出每种材料的长度w.起始地点x.发费c和耐久度f 问:在预算为B的情况下,建好这条路的最大耐久度是多少 解题思路:背包问题 dp[i][j]表示起始地点为 ...
- 使用Android Studo开发NDK之Gradle的配置(能debug C代码)
配置: 用的版本号是AS1.5(也能够尝试更高版本号). Gradle地址是distributionUrl=https\://services.gradle.org/distributions/gra ...
- Hadoop问题记录:Wrong FS: hdfs://hp5-249:9000/, expected: file:///
一般在对文件操作的时候可能出现这个问题,可能是打开文件的时候出错,也可能是对文件夹进行遍历的时候出问题. 出现这样的问题通常是在eclipse中执行hadoop的时候出现,直接切换到shell下发送命 ...
- mysql_udf_http(根据mysql表自动触发发送http请求)
下载 tar包wget http://mysql-udf-http.googlecode.com/files/mysql-udf-http-1.0.tar.gz解压tar -vzxf mysql-ud ...