讨论区里的大佬来帮忙找找错呗
查看原帖
讨论区里的大佬来帮忙找找错呗
822582
kevinhao楼主2024/8/12 13:41
#include<bits/stdc++.h>
using namespace std;
double a,b,c,d,e,x,y,n[2];
int maxx=-1,pos;
int main()
{
    cin>>a>>b>>c>>d>>e>>x>>y;
    n[0]=a*x*1.0+b*1.0*y;
    n[1]=c*y*1.0;
    n[2]=d*y*1.0+e;
    for(int i=0;i<=2;i++)
    {
    	if(n[i]>maxx)
    	{
    		maxx=n[i];
    		pos=i+1;
		}
	}
	cout<<pos<<" ";
	cout<<fixed<<setprecision(2)<<n[pos-1];
    return 0;
}
2024/8/12 13:41
加载中...