百度之星

时间:2024-11-13 15:58:20编辑:奇事君

百度之星

//不理解提示说的什么意思...= =!

#include
#define _DEBUG_MODE_

int MaxIntersperseValue(int *arr, int count)
{
int result = 0;
for (int i = 0; i < count; i++)
{
#ifdef _DEBUG_MODE_
printf("arr[%d]: %d\n", i, arr[i]);
#endif
if (arr[i] > 0)
result++;
arr[i] = arr[i] - 1;
}
#ifdef _DEBUG_MODE_
printf("Result: %d\n", result);
#endif
return result;
}

bool ValidCheck(int *arr, int count, int expectedSum)
{
int sum = 0;
for (int i = 0; i < count; i++)
{
sum += arr[i];
}
if (sum == expectedSum)
return true;
return false;
}

int main()
{
int n;//app count
int m;//dev count
int *apps;
printf("Please input application count(n) & developer count(m):\n");
scanf("%d", &n);
scanf("%d", &m);
apps = new int[m];
printf("Please input the application count that each developer owns:\n");
for (int i = 0; i < m; i++)
{
scanf("%d", apps + i);
}

if (ValidCheck(apps, m, n) == false)
{
printf("Count of input applications is not matched with the application count(n: %d)", n);
delete[] apps;
return 0;
}

int previousInt = 0;
int currentInt = 0;
int result = 0;

while ((currentInt = MaxIntersperseValue(apps, m)) > 0)
{
#ifdef _DEBUG_MODE_
printf("Current: %d\n", currentInt);
#endif
result += previousInt * currentInt;
previousInt = currentInt;
}

printf("Max Intersperse Value is: %d", result);
delete[] apps;
}


百度之星的奖项设置

一等奖1名 ―― 30000元 人民币二等奖2名 ―― 15000元 人民币三等奖5名 ―― 5000元 人民币晋级奖 —— 百度还将会邀请晋级的50位赛手至北京,参加为期3天的总决赛参与奖 ―― 复赛成绩前400名的选手将获得大赛限量纪念版T恤一件另:入围决赛和复赛的选手将自动进入百度公司人才库,将有机会优先参与百度实习计划,接受技术牛人指导职业发展,接触搜索引擎核心技术,并在百度公司的校园招聘活动享受“绿色通道”待遇。

上一篇:大运高速

下一篇:没有了