跳到正文

whitee_be

1820688

可能我这辈子都不会忘记c++吧,恶心到我了

在洛谷打开
资料、奖项与版本

资料

编号
1820688
抓取

#include <bits/stdc++.h> using namespace std; int main() { int n,height[10001];cin >> n; for(int i=1;i<=n;i++){cin >> height[i];}

C++
int temp,re=0;   
for(int i=1;i<=n;i++){
	for(int j=i+1;j<=n;j++){
		temp = (j-i)*min(height[i],height[j]);
		if(temp > re){re = temp;cout << height[i] <<"  "<< height[j]  << "   " <<  re<<endl;}
	}
}
cout << re;   

}

还没有收录这位用户的文章。