結果

問題 No.750 Frac #1
ユーザー mmn15277198
提出日時 2020-06-11 06:44:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 598 bytes
コンパイル時間 929 ms
コンパイル使用メモリ 98,376 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-24 02:48:17
合計ジャッジ時間 2,084 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<deque>
#include<map>
#include<stdio.h>
using namespace std;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	cin >> n;
	vector<int> a(n),b(n);
	vector<pair<double,int>> pa(n);
	for(int i=0;i<n;i++){
		cin >> a[i] >> b[i];
		double temp=(double)a[i]/(double)b[i];
		//cout << temp << endl;
		pa[i].first=temp;
		pa[i].second=i;
	}
	sort(pa.begin(),pa.end());
	for(int i=n-1;i>=0;i--){
		cout << a[pa[i].second] << " " << b[pa[i].second] << endl;
	}
	return 0;
}
0