题意

给你三条边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. 记一次ubuntuyu源码安装node.js

    1.官网下载源码 2.下载后解压,在终端打开,并进入文件夹 3../configure 这一步可谓是一波三折,先是没有Python 安装Python 又说没有G++,安装G++后终于成功执行./con ...

  2. Hadoop2.7.6_02_HDFS常用操作

    1. HDFS常用操作 1.1. 查询 1.1.1.  浏览器查询 1.1.2. 命令行查询 [yun@mini04 bin]$ hadoop fs -ls / 1.2. 上传文件 [yun@mini ...

  3. Java的自动装箱和拆箱

    一.什么是装箱?什么是拆箱? 在前面的文章中提到,Java为每种基本数据类型都提供了对应的包装器类型,至于为什么会为每种基本数据类型提供包装器类型在此不进行阐述,有兴趣的朋友可以查阅相关资料.在Jav ...

  4. P1067 多项式输出

    #include <iostream>#include<cstdio>#include<algorithm>using namespace std;int a[10 ...

  5. 离线安装Cloudera Manager 5和CDH5(最新版5.9.3) 完全教程(六)CM的安装

    一.角色分配 Cloudera Manager Agent:向server端报告当前机器服务状态. Cloudera Manager Server:接受agent角色报告服务状态,以视图界面展现,方便 ...

  6. (1)HomeAssistant 安装开始

    https://www.hachina.io/docs/1843.html 在Windows中安装Python3和HomeAssistant 第一步:在浏览器中访问Python官网网址为:www.py ...

  7. 433 模块 ARDUINO测试

    实验硬件 发射端 Arduino + 433超外差发射机     高,低电平和悬空三种模式切换  由简单的官方库修改 /* This is a minimal sketch without using ...

  8. dubbo报错Data length too large: 10710120处理,及服务提供者协议配置详细说明

    工作中遇到以下报错信息 cause: java.io.IOException: Data length too large: 10710120, max payload: 8388608, chann ...

  9. Qt+QGIS二次开发:读取矢量元素及其属性

    1  概述矢量图层内矢量元素组成,矢量图层的加载由驱动实现,驱动必须实现对矢量图层内元素的读写操作功能. 2 原理矢量元素包含几何和属性两部分组成.几何部分用于提供图形相关内容.属性部分提供与几何相关 ...

  10. MATLAB——单层感知器

    1.创建一个感知器 实例 % example4_1.m p=[-,;-,] % 输入向量有两个分量,两个分量取值范围均为-~ % p = % % - % - t=; % 共有1个输出节点 net=ne ...