結果
| 問題 |
No.750 Frac #1
|
| コンテスト | |
| ユーザー |
dgd1724
|
| 提出日時 | 2018-11-19 06:17:11 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 597 bytes |
| コンパイル時間 | 781 ms |
| コンパイル使用メモリ | 68,116 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-24 15:11:45 |
| 合計ジャッジ時間 | 1,925 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
int main() {
//std::ifstream inf("Text.txt"); std::cin.rdbuf(inf.rdbuf());
struct MyStruct
{
int a;
int b;
double c;
};
int n = 0;
std::cin >> n;
std::vector<MyStruct> A(n);
for (int i = 0; i < n; i++) {
std::cin >> A[i].a;
std::cin >> A[i].b;
A[i].c = static_cast<double>(A[i].a) / A[i].b;
}
std::sort(A.begin(), A.end(), [](const MyStruct& x, const MyStruct& y) {return x.c > y.c; });
for (int i = 0; i < n; i++) {
std::cout << A[i].a << " " << A[i].b << std::endl;
}
return 0;
}
dgd1724