求绝对值最大值
来源:互联网 发布:斗鱼裴语燕 知乎 编辑:程序博客网 时间:2024/06/06 12:20
求绝对值最大值
Time Limit: 1000MS Memory Limit: 65536KB
Submit Statistic
Problem Description
求n个整数中的绝对值最大的数。
Input
输入数据有2行,第一行为n,第二行是n个整数。
Output
输出n个整数中绝对值最大的数。
Example Input
5
-1 2 3 4 -5
Example Output
-5
Hint
Author
#include <stdio.h>#include <stdlib.h>#include <math.h>int main(){ int n,i,max = 0,cn = 0; scanf("%d",&n); int a[n]; for(i = 0;i < n;i++) { scanf("%d",&a[i]); if(a[i]<0) { if(max < -a[i]) { max = -a[i]; cn = i; } } else { if(max < a[i]) { max = a[i]; cn = i; } } } printf("%d\n",a[cn]); return 0;}
阅读全文
0 0
- 求绝对值最大值
- 求绝对值最大值
- 求绝对值最大值
- 求绝对值最大值
- 求绝对值最大值
- 求绝对值最大值
- 求绝对值最大值
- 求绝对值最大值 (sdut oj)
- SDUT-1147 求绝对值最大值
- 山东理工ACM【1147】求绝对值最大值
- 二叉树遍历求差值绝对值最大值
- 求数组左部分最大值减去右部分最大值的绝对值的最大值
- 求绝对值
- 求绝对值
- 求绝对值
- 求绝对值
- 求绝对值
- 求绝对值
- 2017年10月、11月 windows 用360 打最新补丁导致的问题
- CVX error:Conversion to double from cvx is not possible解决方案
- flume介绍与原理
- ajax 跨域 headers JavaScript ajax 跨域请求 +设置headers 实践
- 曲海佳:我是如何用PTENGINE提升信息流广告投放效果的
- 求绝对值最大值
- 网站分析的“十字箴言”
- 图像处理(五):八邻域边缘跟踪与区域生长算法
- 国外值得关注的十三家大数据与分析公司
- iOS开发Push和Present混用返回指定控制器
- 沃达丰:2017物联网市场晴雨表(附下载)
- web前端-HTML常用链接图像标签
- <meta name="" content="">的作用
- GSMA:2026年欧洲联网能源市场将达到260亿美元