Untitled
unknown
plain_text
23 days ago
866 B
3
Indexable
Never
#include <bits/stdc++.h> #define ll long long using namespace std; ll waiter[10000],doi[10000]; int main() { long long n,k,sum,cur,sulfur=1000000,funkin=0,xmax=0,ben10=0; cin >> n>>k; for (int i=0; i<=n-1; i++) { cin >> waiter[i]; xmax=max(xmax,waiter[i]); } sort(waiter,waiter+n); for (int i=0; i<=k-1; i++) { sum =0; for (int f=0; f<=n-1; f++) { cur =i; nhan: doi[f]=cur -waiter[f]; if (doi[f]<0) { cur +=k; goto nhan ; } sum+=doi[f]; } if (sum<sulfur) { sulfur=sum; funkin=i; } } cout <<sulfur<<endl; cout <<xmax%k+1 <<endl;//khong biet lam gi return 0; }
Leave a Comment