注释部分不太懂
查看原帖
注释部分不太懂
1468351
BIGzh楼主2024/11/26 20:03

注释部分不太懂

#include<bits/stdc++.h>
using namespace std;
int a[5][11],temp[5];
int t[5][11],minx,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++)
    {
        minx=2100000000;
        for(int j=0;j<5;j++)
        {
            if(t[j][temp[j]+1]<minx and temp[j]+1<=10)
            {
                tag=j;
                minx=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;
}
2024/11/26 20:03
加载中...