poj3632
来源:互联网 发布:临沂拓普网络拖欠工资 编辑:程序博客网 时间:2024/06/05 18:23
题目大意:
Michael去逛街,给出每个商店的位置,问Michael把车停在哪里走步距离最短
解题思路:
其实停哪里都一样,都是整个距离的2倍
代码如下:
#include<stdio.h>#include<stdlib.h>#include<string.h>int main(){ int t,i,n,j,max,min; int num[25]; scanf("%d",&t); for(i=1;i<=t;i++) { max=-1,min=120; scanf("%d",&n); for(j=1;j<=n;j++) { scanf("%d",&num[j]); if(num[j]<min) { min=num[j]; } if(num[j]>max) { max=num[j]; } } printf("%d\n",2*(max-min)); } return 0;}
0 0
- poj3632
- poj3632
- poj3632
- poj3632
- poj3632
- poj3632 Optimal Parking!
- POJ3632 找停车点
- POJ3632解题报告
- 北大ACM poj3632 Optimal Parking
- poj3589
- Debug与Release版本的区别详解
- 17 - 05 - 16 HTML( <div> 标签)
- poj3619
- NodeJS常用模块介绍
- poj3632
- poj3637
- 寒假篇39
- 母函数 初步刷题
- android:layout_gravity 和 android:gravity 的区别
- poj3650
- 洛谷 P1201 [USACO1.1]贪婪的送礼者Greedy Gift Givers
- spring不通过注入的方式获取对象(BeanFactoryAware \ApplicationContextAware )
- poj3664