题意

给你三条边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. 离群点检测与序列数据异常检测以及异常检测大杀器-iForest

    1. 异常检测简介 异常检测,它的任务是发现与大部分其他对象不同的对象,我们称为异常对象.异常检测算法已经广泛应用于电信.互联网和信用卡的诈骗检测.贷款审批.电子商务.网络入侵和天气预报等领域.这些异 ...

  2. 由内省引出JavaBean的讲解

    IntroSpector--内部检查,了解更多细节--内省---JavaBean 一.JavaBean JavaBean是一种特殊的Java类,主要用于传递数据信息,这种java类中的方法主要用户访问 ...

  3. Paramiko和堡垒机实现

    一.Paramiko paramiko模块,基于SSH用于连接远程服务器并执行相关操作. 1.安装:pip install paramiko 2.SSHClient:用于连接远程服务器并执行基本命令 ...

  4. logstash之input、codec学习

    Logstash最强大的功能在于丰富的过滤器插件.此过滤器提供的并不单单是过滤的功能,还可以对进入过滤器的原始数据进行复杂的逻辑处理.甚至添加独特的事件到后续流程中. 1.logstash基本语法组成 ...

  5. Linux 小知识翻译 - 「Shell」(也就是命令行接口)

    这次说说关于Shell的东西. 「Shell」是看不见实体的,所以理解起来可能会有些困难. 最近的Linux发行版默认都是用X Window System来操作的(也就是图形化操作),所以很少见到有人 ...

  6. 使用POI读写word docx文件

    目录 1     读docx文件 1.1     通过XWPFWordExtractor读 1.2     通过XWPFDocument读 2     写docx文件 2.1     直接通过XWPF ...

  7. Properties集合_list方法与store方法

    Properties集合和流对象结合的功能 list()方法: import java.util.Properties; public class PropertiesDemo { public st ...

  8. python3 练习题(多级菜单)

    '''多级菜单需求:1.现有省/市/县3级结构,要求程序启动后,允许用户可依次选择进入各子菜单2.可在任意一级菜单返回上一级3.可以在任意一级菜单退出程序所需新知识点: 列表/字典'''menu = ...

  9. Linux上VsCode编译打包运行

    前提:最好使用root用户可以排除一些不必要的错误. 一. 准备环境 Node.js(>= 8.12.0, < 9.0.0) Python2.7 Yarn(可以通过npm install ...

  10. 20175310 《Java程序设计》第5周学习总结

    20175310 <Java程序设计>第5周学习总结 本周博客: <20175310 迭代和JDB - 20175310xcy - 博客园> https://www.cnblo ...