1 solutions
-
0
C++ :
#include <bits/stdc++.h> using namespace std; struct Node{ int id; double w,h,bmi; friend bool operator < (Node a,Node b){ return a.bmi > b.bmi; } } a[1005]; int main(){ int n; cin >> n; for (int i = 1;i<=n;i++){ a[i].id = i; cin >> a[i].w; } for (int i = 1;i<=n;i++){ cin >> a[i].h; a[i].bmi = a[i].w / (a[i].h * a[i].h); } sort(a+1,a+1+n); for (int i = 1;i<=n;i++) cout << a[i].id << " "; return 0; }
- 1
Information
- ID
- 243
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By