Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* BISMILLAHIR-RAHMANIR-RAHIM
- ____________________________________
- | |
- | SHANTO_SUST_SWE-19_029 |
- |____________________________________|
- */
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
- #define pb push_back
- #define Pi acos(-1.0)
- #define r0 return 0
- #define endl "\n"
- #define show(x) cout << x << endl
- #define take(x) cin >> x
- #define debug 1
- struct fraction{
- long double x, y;
- long double d;
- };
- int main()
- {
- int n, i, j;
- cin >> n;
- vector < fraction > f(n);
- fraction temp;
- for(i = 0; i < n; i++) {
- cin >> f[i].x >> f[i].y;
- f[i].d = f[i].x / f[i].y;
- }
- for(i = 0; i < n; i++) {
- for(j = i + 1; j < n; j++) {
- if(f[i].d < f[j].d) {
- temp = f[j];
- f.erase(f.begin() + j);
- f.insert(f.begin() + i, temp);
- }
- }
- }
- for(i = 0; i < n; i++) {
- cout << (long long)f[i].x << " " << (long long)f[i].y << endl;
- }
- r0;
- }
- //ALHAMDULILLAH
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement