求绝对值最大值
来源:互联网 发布:淘宝怎样注销实名认证 编辑:程序博客网 时间:2024/06/13 02:33
求绝对值最大值
Time Limit: 1000MS Memory Limit: 65536KB
SubmitStatistic
Problem Description
求n个整数中的绝对值最大的数。
Input
输入数据有2行,第一行为n,第二行是n个整数。
Output
输出n个整数中绝对值最大的数。
Example Input
5-1 2 3 4 -5
Example Output
-5
#include <stdio.h>#include <stdlib.h>int main(){ int i,n,a,fa,max,maxold; scanf("%d",&n); scanf("%d",&a); if(a<0) { max=-a; } else max=a; maxold=-a; for(i=1;i<n;i++) { scanf("%d",&a); fa=a; if(a<0) { fa=-a; } if(max<fa) { max=fa; maxold=a;}} printf("%d",maxold);return 0;}
阅读全文
0 0
- 求绝对值最大值
- 求绝对值最大值
- 求绝对值最大值
- 求绝对值最大值
- 求绝对值最大值
- 求绝对值最大值
- 求绝对值最大值
- 求绝对值最大值 (sdut oj)
- SDUT-1147 求绝对值最大值
- 山东理工ACM【1147】求绝对值最大值
- 二叉树遍历求差值绝对值最大值
- 求数组左部分最大值减去右部分最大值的绝对值的最大值
- 求绝对值
- 求绝对值
- 求绝对值
- 求绝对值
- 求绝对值
- 求绝对值
- 如何高速下载百度云资源
- 《java与模式》-12 合成模式
- POJ 3449 Geometric Shapes <几何(简单相交判断)>
- 二、Android安全机制之系统防线
- hadopp 环境搭建
- 求绝对值最大值
- gulp+webpack
- java中的try catch finally return的执行顺序问题总结
- python实现二叉树和它的七种遍历
- 算法与数据结构——算法题32:整数集合的交集(腾讯笔试) ? 待解决
- Java Spring框架初识
- Spring之HelloWorld
- 例题8-2 联合国大楼(Building for UN, ACM/ICPC NEERC 2007, UVa1605)
- Diff Two Arrays