VioletaBabel
5054번: 주차의 신 본문
#include <cstdio>
using namespace std;
int main()
{
int t;
scanf("%d", &t);
while (t--)
{
int n, max = -1, min = 100, shop[20];
scanf("%d", &n);
for (int i = 0; i < n; ++i)
{
scanf("%d", &shop[i]);
max = (shop[i] > max) ? shop[i] : max;
min = (shop[i] < min) ? shop[i] : min;
}
printf("%d\n", (max - min) * 2);
}
}
'백준 > 백준-C++' 카테고리의 다른 글
4948번: 베르트랑 공준 (0) | 2017.05.27 |
---|---|
2960번: 에라토스테네스의 체 (0) | 2017.05.27 |
1929번: 소수 구하기 (0) | 2017.05.26 |
1978번: 소수 찾기 (0) | 2017.05.26 |
10866번: 덱 (0) | 2017.05.26 |
Comments