9881번

· 백준
코드#include #include #include using namespace std;int n, a[1003], res = INT_MAX;void FASTIO() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}int main() { FASTIO(); cin >> n; for (int i = 0; i > a[i]; } sort(a, a + n); // 가능한 모든 구간 탐색 for (int low = 0; low high) { cost += (a[i] - high) * (a[i] - high); } } r..