此题数据对吗?为啥我得出8373呢?我算了一遍没错啊?求解释。(附c++代码)
#include<iostream>
using namespace std;
int main(){
int a[5][10]={},c[5]={1,1,1,1,1},temp,small=999999,sum=0;
for(int i=0;i<5;i++){
for(int j=0;j<10;j++){
cin>>a[i][j];
}
}
for(int i=0;i<20;i++){
small=999999;
for(int j=0;j<5;j++){
if(a[j][c[j]]-a[j][c[j]-1]<small&&c[j]<10){
small=a[j][c[j]]-a[j][c[j]-1];
temp=j;
}
}
sum+=small;
c[temp]++;
}
cout<<sum<<endl;
for(int i=0;i<5;i++){
cout<<c[i]<<' ';
}
}