- 【START】2015暑期训练——Spreading the Wealth
榜一来看会不会(已有翻译)
- 2024-7-16 10:51:21 @
翻译在提解里
6 comments
-
谢煜龙 LV 6 @ 2024-7-17 13:32:03
6
-
2024-7-16 16:29:19@
但是过不了 我也不知道为什么
🤡 1 -
2024-7-16 16:28:52@
一对的#include <>直接当做#include <bits/stdc++.h>
-
2024-7-16 16:28:03@
这个代码自测里是可以的
-
2024-7-16 16:27:40@
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace std; #define INF 0x7fffffff typedef long long ll; const int maxn=1e6+10; ll A[maxn],C[maxn],tot,M; int n;
int main() { while(scanf("%lld",&n)!=EOF){ tot=0; for(int i=0;i
🤔 1 -
2024-7-16 16:27:09@
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace std; #define INF 0x7fffffff typedef long long ll; const int maxn=1e6+10; ll A[maxn],C[maxn],tot,M; int n;
int main() { while(scanf("%lld",&n)!=EOF){ tot=0; for(int i=0;i<n;i++){ scanf("%lld",&A[i]); tot+=A[i]; } M=tot/n; C[0]=0; for(int i=1;i<n;i++){ C[i]=C[i-1]+A[i]-M; } sort(C,C+n); ll x1=C[n/2],ans=0; for(int i=0;i<n;i++){ ans+=fabs(C[i]-x1); } printf("%lld\n",ans); } return 0; }
- 1
Information
- ID
- 945
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 10
- Tags
- (None)
- # Submissions
- 3
- Accepted
- 0
- Uploaded By