题意

给你三条边a,b,c问使得构成三角形,需要增加的最少长度是多少

思路

数学了啦

代码

#include<bits/stdc++.h>
using namespace std;
#define ll long long int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
//freopen("in.txt","r",stdin);
int a,b,c;
while(cin>>a>>b>>c){
if(a+b>c&&a+c>b&&b+c>a)
{
cout<<0<<endl;
continue;
}
int i=a+b-c,j=a+c-b,k=b+c-a;
int h=min(i,min(j,k));
if(h<=0) cout<<-h+1<<endl;
}
return 0;
}

A. Make a triangle!的更多相关文章

  1. [LeetCode] Triangle 三角形

    Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent n ...

  2. [LeetCode] Pascal's Triangle II 杨辉三角之二

    Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3, ...

  3. [LeetCode] Pascal's Triangle 杨辉三角

    Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Retur ...

  4. 【leetcode】Pascal's Triangle II

    题目简述: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Retur ...

  5. 【leetcode】Pascal's Triangle

    题目简述: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5 ...

  6. POJ 1163 The Triangle(简单动态规划)

    http://poj.org/problem?id=1163 The Triangle Time Limit: 1000MS   Memory Limit: 10000K Total Submissi ...

  7. Triangle - Delaunay Triangulator

    Triangle - Delaunay Triangulator  eryar@163.com Abstract. Triangle is a 2D quality mesh generator an ...

  8. LeetCode 118 Pascal's Triangle

    Problem: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows  ...

  9. LeetCode 119 Pascal's Triangle II

    Problem: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Ret ...

  10. 【leetcode】Triangle (#120)

    Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent n ...

随机推荐

  1. log4.net 配置 - 自定义过滤器按LoggerName过滤日志

    自定义过滤器按LoggerName过滤日志,本来想使用 PropertyFilter 来实现,后来研究发现一直不能成功,源代码debug了一下获取一直为null,时间关系只好用 StringMatch ...

  2. ConcurrentLinkedQueue源码解读

    1.简介 ConcurrentLinkedQueue是JUC中的基于链表的无锁队列实现.本文将解读其源码实现. 2. 论文 ConcurrentLinkedQueue的实现是以Maged M. Mic ...

  3. C# 响应微信发送的Token验证,文字、图文自动回复、请求客服对话.....

    代码如下,有需要的可以参考: using System; using System.Collections.Generic; using System.Linq; using System.Web; ...

  4. 微软公布针对最新IE漏洞的安全通报2963983

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/MSSecurity/article/details/24637607  微软于昨天公布了一篇最新 ...

  5. MySQL性能分析工具之PROFILE

    Mysql Profile 如何开启Profiles功能以及如何简单使用: https://www.cnblogs.com/zengkefu/p/6519010.html MySQL profiles ...

  6. php递归无限级

    function getTree($data, $pId) { $tree = ''; foreach($data as $k => $v) { if($v['cate_ParentId'] = ...

  7. YOLO2 (2) 测试自己的数据

    Windos10 linux同样过程 现有问题: 本文过程在linux下类似,可以正常通过.windons下,运行python脚本出现问题,无法正常输出0001.txt(标定文件),所以只能使用lin ...

  8. redsi一主两从三哨兵

    1.前提准备 防火墙,selinux,主机名解析,所有主机安装gcc [root@localhost ~]# vim /etc/hosts 192.168.122.135  redis_master ...

  9. Ubuntu无法连接WiFi

    lspci | grep Network1.查看自己的无线网卡驱动2.下载驱动https://www.intel.cn/content/www/cn/zh/support/articles/00000 ...

  10. 迭代和JDB调试

    迭代和JDB调试 题目要求 1 使用C(n,m)=C(n-1,m-1)+C(n-1,m)公式进行递归编程实现求组合数C(m,n)的功能 2 m,n 要通过命令行传入 3 提交测试运行截图(至少三张:正 ...