結果

問題 No.750 Frac #1
ユーザー Mcpu3
提出日時 2018-11-14 22:09:06
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 410 bytes
コンパイル時間 536 ms
コンパイル使用メモリ 64,812 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-06 06:19:06
合計ジャッジ時間 1,536 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

struct s {
	int A, B;
};

int compare(const void *x, const void *y) {
	return ((s*)x)->B * ((s*)y)->A - ((s*)x)->A * ((s*)y)->B;
}

int main() {
	int n;
	cin >> n;
	s frac[n];
	for (int i = 0; i < n; ++i) cin >> frac[i].A >> frac[i].B;
	qsort(frac, n, sizeof(s), compare);
	for (int i = 0; i < n; ++i) cout << frac[i].A << ' ' << frac[i].B << endl;
}
0