CSES - Putka Open 2015 – 1/6 - Results
Submission details
Task:Jakkara
Sender:
Submission time:2015-07-19 16:52:41 +0300
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp:4:20: fatal error: stdafx.h: No such file or directory
 #include "stdafx.h"
                    ^
compilation terminated.

Code

// CPPBook.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	
	long a, b, c, d, sum = 0;
	cin >> a >> b >> c >> d;
	long arr[]{ a,b,c,d };

	sort(arr, arr + 4);
	long mediane = arr[1];

	for (long l : arr) { sum += abs(mediane - l); }

	cout << sum << endl;

	return EXIT_SUCCESS;
}