結果

問題 No.750 Frac #1
ユーザー Kura
提出日時 2019-02-14 22:53:24
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 450 bytes
コンパイル時間 663 ms
コンパイル使用メモリ 66,880 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 11:34:38
合計ジャッジ時間 1,788 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int> a(n),b(n),A(n),B(n);
	vector<double> c(n),C(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
		c[i] = 1.0f*a[i] / b[i];
		C[i] = c[i];
	}
	sort(C.begin(), C.end());
	for (int i = n-1; i >= 0; i--) {
		for (int j = 0; j < n; j++) {
			if (C[i] == c[j]) {
				cout << a[j] << " " << b[j] << endl;
				break;
			}
		}
	}
}
0