马拉松接力赛
来源:互联网 发布:2017全球社交网络排名 编辑:程序博客网 时间:2024/05/17 00:52
#include<bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int a[5][11],temp[5];
int t[5][11],Min,tag,sum;
int main()
{
for(int i=0;i<5;i++)
for(int j=1;j<11;j++)
{
cin>>a[i][j];
t[i][j]=a[i][j]-a[i][j-1];
}
temp[0]=temp[1]=temp[2]=temp[3]=temp[4]=1;
for(int i=0;i<20;i++)
{
Min=INF;
for(int j=0;j<5;j++)
{
if(t[j][temp[j]+1]<Min&&temp[j]+1<=10)
{
tag=j;
Min=t[j][temp[j]+1];
}
}
temp[tag]++;
}
sum=0;
for(int i=0;i<5;i++)
sum+=a[i][temp[i]];
cout<<sum<<endl;
cout<<temp[0]<<" "<<temp[1]<<" "<<temp[2]<<" "<<temp[3]<<" "<<temp[4]<<endl;
return 0;
}
using namespace std;
const int INF = 0x3f3f3f3f;
int a[5][11],temp[5];
int t[5][11],Min,tag,sum;
int main()
{
for(int i=0;i<5;i++)
for(int j=1;j<11;j++)
{
cin>>a[i][j];
t[i][j]=a[i][j]-a[i][j-1];
}
temp[0]=temp[1]=temp[2]=temp[3]=temp[4]=1;
for(int i=0;i<20;i++)
{
Min=INF;
for(int j=0;j<5;j++)
{
if(t[j][temp[j]+1]<Min&&temp[j]+1<=10)
{
tag=j;
Min=t[j][temp[j]+1];
}
}
temp[tag]++;
}
sum=0;
for(int i=0;i<5;i++)
sum+=a[i][temp[i]];
cout<<sum<<endl;
cout<<temp[0]<<" "<<temp[1]<<" "<<temp[2]<<" "<<temp[3]<<" "<<temp[4]<<endl;
return 0;
}
1 0
- 马拉松接力赛
- 接力赛
- 马拉松
- foj 1593 数字接力赛
- 做UI如同举行一场接力赛
- 人生马拉松
- 马拉松原理
- cogs19461946. 马拉松
- 马拉松记
- 【题&结论】【图(Floyd)&矩阵】NKOJ 1895 奶牛接力赛
- 贪心算法求跑完整个接力赛最少时间
- 入门篇(4)NAO机器人接力赛通信问题
- 马拉松(一)
- 2009北京国际马拉松
- 马拉松(二)
- 生命是场马拉松
- 厦门马拉松之旅
- 马拉松比赛公司第一
- js与webview的交互:stringByEvaluatingJavaScriptFromString的使用方法
- Spring4.x官方参考文档中文版——第21章 Web MVC框架(33)
- 一些关于path环境变量的问题
- 泛型分析
- 优先队列
- 马拉松接力赛
- Gradle编译时下载依赖失败解决方法
- typeof运算符
- Java web 三大框架异常学习总结
- 简单密码
- 深入了解Android蓝牙Bluetooth——《进阶篇》
- GalaxyOJ-64 (分块)
- iOS10适配
- request.getSession().getServletContext().getRealPath 为null