【链接】h在这里写链接
【题意】
看懂题目之后就会发现是道大水题。
【题解】
在这里写题解
【错的次数】
0
【反思】
在这了写反思
【代码】
#include <bits/stdc++.h> using namespace std; int n,k,ans; int main(){ //freopen("F:\\rush.txt","r",stdin); ios::sync_with_stdio(0),cin.tie(0); cin >> n; cin >> k; for (int i = 1,x;i <= n;i++){ cin >> x; ans += 2*min(x,k-x); } cout << ans << endl; return 0; }