QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#236042 | #6702. Stones in the Bucket | stcmuyi# | AC ✓ | 49ms | 3808kb | C++20 | 615b | 2023-11-03 15:48:00 | 2023-11-03 15:48:01 |
Judging History
answer
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define i64 long long
#define endl '\n'
#define lb(x) ((x) & (-x))
using namespace std;
const i64 mod = 1e15+7;
const int maxn = 1e3+10;
signed main()
{
IOS;
int t; cin >> t;
while(t--)
{
int n; cin >> n;
vector<int> a(n+1);
i64 sum = 0;
for(int i = 1; i <= n; ++i) cin >> a[i],sum += a[i];
sum /= n;
i64 ans = 0;
for(int i = 1; i <= n; ++i) if(a[i] > sum) ans += a[i] - sum;
cout << ans << endl;
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3448kb
input:
4 3 1 1 0 4 2 2 2 2 3 0 1 4 1 1000000000
output:
2 0 3 0
result:
ok 4 number(s): "2 0 3 0"
Test #2:
score: 0
Accepted
time: 49ms
memory: 3808kb
input:
1117 33 941569937 726092914 727010359 7765372 85147698 226034704 430957397 690012188 507130442 797501882 635162155 159230168 519209938 874599298 394229092 840562882 790604785 404365317 201055932 846306030 538284769 767560597 989100484 910102919 156114543 743142429 790221319 144002373 730823403 97104...
output:
4211193781 3489319388 4015689082 4369484417 12451656301 3389745192 9279595149 7756415264 8458888261 9562054408 8819462646 8776257522 3213169624 849909175 9911233579 224339683 8383256653 4953209012 7534373352 9297501816 1839870320 3914938851 8950069661 7010274970 9453850869 8777334685 3992301260 8296...
result:
ok 1117 numbers