結果

問題 No.750 Frac #1
ユーザー greentea011
提出日時 2019-03-27 16:59:22
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 546 bytes
コンパイル時間 742 ms
コンパイル使用メモリ 82,736 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 02:23:51
合計ジャッジ時間 1,960 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <sstream>
#include <map>
#include <algorithm>
#include <iterator>

void disp(const std::pair<float,std::string>& x) {
  std::cout << x.second << std::endl;
}

int main() {
    int n;
    int a,b;
    std::map<float,std::string> v;
    std::cin >> n;
    for (int i=0;i<n;i++) {
        std::cin >> a >> b;
        std::stringstream ss;
        ss << a << " " << b;
        v.insert(std::pair<float,std::string>((float)a/(float)b, ss.str()));
    }
    
    std::for_each(v.rbegin(),v.rend(),disp);
}
0