团体程序设计天梯赛 L1-056 猜数字
#include
#include
#include
using namespace std;
int main()
{
string nam[10000];
int n,arry[10000];
cin >> n;
for (int i = 0; i < n; i++)
cin >> nam[i] >> arry[i];
int sum = 0,m=0;
for (int i = 0; i < n; i++)
sum += arry[i];
sum /= n*2;
for (int i = 0; i < n; i++)
arry[i] = fabs(sum - arry[i]);
for (int i = 1; i < n; i++)
if (arry[i] < arry[m]) m = i;
cout << sum <<' ';
cout<
共有 0 条评论