| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 108579 | 曾煦翔 | 均分纸牌 | C++ | Wrong Answer | 40 | 0 MS | 260 KB | 517 | 2023-11-03 21:09:52 |
#include<bits/stdc++.h> using namespace std; struct node { int ans; }a[10005]; bool cmp (node x , node y) { return x.ans < y.ans; } int main() { int n; cin >> n; int sum = 0; for(int i = 1;i <= n;i++) { cin >> a[i].ans; sum += a[i].ans; } int cnt = 0; sort(a + 1 , a + n + 1, cmp); int jun = sum / n; for(int i = 1;i <= n;i++) { if(a[i].ans < jun) { a[i + 1].ans = a[i + 1].ans - jun + a[i].ans; a[i].ans = jun; cnt++; } } cout << cnt; return 0; }