// test65764.cpp : 定义控制台应用程序的入口点。
//
// test14.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int work_day = 0;
int n = 0;
int result = 0;
cin >>n;
int *work_efficiency = new int[n];
for (int i = 0; i < n; i++)
cin >> *(work_efficiency + i);
for(int i = 0;i<n;i++)
{
for(int j = i+1;j<n;j++)
{
if((*(work_efficiency + i)) < (*(work_efficiency + j)))
{
int temp = 0;
temp = *(work_efficiency + i);
(*(work_efficiency + i)) = (*(work_efficiency + j));
(*(work_efficiency + j)) = temp;
}
}
}
work_day = n / 3 * 2 + n % 3;
for (int i = 0; i <work_day; i++)
{
result += *(work_efficiency + i);
}
cout << result;
delete[] work_efficiency;
while (1);
return 0;
}
题目一
最新推荐文章于 2021-03-18 01:05:03 发布