結果

問題 No.750 Frac #1
ユーザー eyeSharp
提出日時 2019-10-16 22:15:27
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 617 bytes
コンパイル時間 1,493 ms
コンパイル使用メモリ 171,932 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-23 05:00:16
合計ジャッジ時間 2,550 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
    No.750 Frac #1
    https://yukicoder.me/problems/no/750
*/
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;
    vector<pair<double, string>> vsd(n);

    for (int i = 0; i < n; i++) {
        int left, right;
        cin >> left >> right;
        string s = to_string(left) + " " + to_string(right);
        vsd[i] = make_pair((double)left / right, s);
    }

    // sorted
    sort(vsd.begin(), vsd.end());

    for (int i = n - 1; i >= 0; i--) {
        // cout << vsd[i].first;
        cout << vsd[i].second << endl;
    }
}
0