第8个题解
2026-09-25 11:25:45
发布于:江苏
0阅读
0回复
0点赞
必回关
#include<iostream>
#include<algorithm>
using namespace std;
short n;
int main(){
cin.tie(0);
ios::sync_with_stdio(0);
cout.tie(0);
cin>>n;
float w[n],h;
short x[n];
for(short i=0;i<n;i++){
cin>>w[i];
x[i]=i+1;
}
for(short i=0;i<n;i++){
cin>>h;
w[i]=w[i]/h/h;
}for(short i=0;i<n;i++){
for(short j=i+1;j<n;j++){
if(w[i]<w[j]){
swap(w[i],w[j]);
swap(x[i],x[j]);
}
}
}for(short i=0;i<n;i++){
cout<<x[i]<<' ';
}
return 0;
}
这里空空如也







有帮助,赞一个