思路:海伦公式, AC代码: #include<bits/stdc++.h> using namespace std; int main() { int n; scanf("%d",&n); double ha, hb, hc, a, b, c; while(~scanf("%lf %lf %lf",&ha,&hb,&hc)) { a = 2.0 / ha; b = 2.0 / hb ; c = 2.0 / hc; if(
""" 已知三角形的边长求他的面积和周长 Author:罗万财 Date:2017-3-3 """ import math a=float(input('a=')) b=float(input('b=')) c=float(input('c=')) if a+b>c and a+c>b and b+c>a: d=a+b+c e=(a+b+c)/2 f=math.sqrt(e*(e-a)*(e-b)*(e-c)) print('三
编写一个控制台应用程序,输入三角形或者长方形边长,计算其周长和面积并输出. 代码: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Lab001 { class Program { static void Main(string[] args) { int i; int j=1; double
题目链接:传送门 知识点: (1)三个点,三角形求面积公式 (2)精度问题: double 15-16位(参考文章) float 6-7位 long long 约20位 int 约10位 unsigned int 是int的两倍(参考文章) (3)nth_element()函数 思路:一开始想直接暴力求面积,然后面积排序,后来有发现面积不能是0,可以重复, 然后排序求出第k大的值,结果没注意double的位数不能精确到达到18位,然后又想四舍五入, 对尾数进行了处理,还是没过.看来题解才发现最后
链接:http://poj.org/problem?id=3348 Cows Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 6677 Accepted: 3020 Description Your friend to the south is interested in building fences and turning plowshares into swords. In order to help with
def j(): a,b,c=map(float,input('请输入三角形三条边的长度,用空格隔开:').split()) if a>0 and b>0 and c>0 and a+b>c and a+c>b and b+c>a: l=a+b+c p=l/2 s=p*(p-a)*(p-b)*(p-c)#海伦公式 print('三角形的周长:{:.2f}\n三角形的面积:{:.2f}'.format(l,s)) else: print('三角形不成立,请重新输入') j
Herding Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1553 Accepted Submission(s): 440 Problem Description Little John is herding his father's cattles. As a lazy boy, he cannot tolerate chasing t
题目: http://poj.org/problem?id=1408 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22013#problem/C Fishnet Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 1604 Accepted: 1026 Description A fisherman named Etadokah awoke in a very