結果
問題 | No.750 Frac #1 |
ユーザー |
|
提出日時 | 2019-09-20 22:49:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 695 bytes |
コンパイル時間 | 2,139 ms |
コンパイル使用メモリ | 180,920 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-14 18:56:40 |
合計ジャッジ時間 | 3,310 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; bool PairCmp(pair<string, double> p1, pair<string, double> p2); int main() { int n; vector<pair<string, double>> v; cin >> n; double tmp1, tmp2; for (int i = 0; i < n; i++) { cin >> tmp1 >> tmp2; string s = ""; s += to_string(static_cast<int>(tmp1)) + " " + to_string(static_cast<int>(tmp2)); v.push_back(make_pair(s, tmp1/tmp2)); } sort(v.begin(), v.end(), PairCmp); for (int i = 0; i < n; i++) { cout << v[i].first << endl; } return 0; } bool PairCmp(pair<string, double> p1, pair<string, double> p2) { return p1.second > p2.second; }