本文最后更新于 1170 天前,其中的信息可能已经有所发展或是发生改变。
代码语言:javascript复制// ZOJ1251 Box of Bricks(POJ1477) 很简单 数学题.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include<iostream>
using namespace std;
int main()
{
int n3,b=1;
while (1)
{
int n4 = 0;
int sum = 0;
int s[55];
cin >> n3;
if (n3 == 0)
break;
for (int i = 0; i < n3; i )
{
int n2;
cin >> n2;
s[i] = n2;
sum = s[i];
}
int m = sum / n3;
for (int i = 0; i < n3; i )
{
if (s[i]>m)
n4 = s[i] - m;
}
cout << "Set #" << b << endl;
cout <<"The minimum number of moves is "<< n4<<"."<<endl;
cout << endl;
b ;
}
return 0;
}
Post Views: 171