Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
108359 Block Xuan 均分纸牌 C++ 通过 100 0 MS 240 KB 963 2023-11-02 13:35:19

Tests(5/5):


//I am Block Xuan #include<bits/stdc++.h> //I am Block Xuan using namespace std; //I am Block Xuan int a[114],cnt; //I am Block Xuan int main(){ //I am Block Xuan int n,sum = 0; //I am Block Xuan cin>>n; //I am Block Xuan for (int i = 1;i <= n;i++){ //I am Block Xuan cin>>a[i]; //I am Block Xuan sum += a[i]; //I am Block Xuan } //I am Block Xuan sum /= n; //I am Block Xuan for (int i = 1;i < n;i++){ //I am Block Xuan if (a[i] < sum){ //I am Block Xuan a[i + 1] -= (sum - a[i]); //I am Block Xuan a[i] = sum; //I am Block Xuan cnt++; //I am Block Xuan } //I am Block Xuan else if (a[i] > sum){ //I am Block Xuan a[i + 1] += a[i] - sum; //I am Block Xuan a[i] = sum; //I am Block Xuan cnt++; //I am Block Xuan } //I am Block Xuan } //I am Block Xuan cout<<cnt; //I am Block Xuan return 0; //I am Block Xuan } //I am Block Xuan


测评信息: