/* yukicoder No.21 作成者:ヒロソフ 使用言語:C++(new , delete使用の為) */ #include int main(void) { int N, K, *pNums ; scanf("%d", &N); scanf("%d", &K); pNums = new int[N]; for (int i = 0; i < N; i++) { scanf("%d", pNums + i); } int Min = *(pNums), Max = *(pNums) ,Current; for (int i = 1; i < N; i++) { Current = *(pNums + i); Min = (Current < Min) ? Current : Min; Max = (Current > Max) ? Current : Max; } printf("%d\n", Max - Min); delete[]pNums; return 0; }