結果

問題 No.750 Frac #1
ユーザー shioya
提出日時 2019-05-18 23:49:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 36 ms / 1,000 ms
コード長 551 bytes
コンパイル時間 2,352 ms
コンパイル使用メモリ 206,732 KB
最終ジャッジ日時 2025-01-07 03:45:55
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef pair<double,string> frcval;

bool pairCompare(const frcval& firstElof,const frcval& secondElof)
{
	return firstElof.first > secondElof.first;
}

int main()
{
	vector<frcval> frcvec;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		double a,b;
		frcval tmp;
		cin>>a>>b;
		tmp.first = a/b;
		tmp.second = to_string((int)a)+ " "+to_string((int)b);
		frcvec.push_back(tmp);
	}
	sort(frcvec.begin(),frcvec.end(),pairCompare);
	for(int i=0;i<frcvec.size();i++){
		cout<<frcvec[i].second<<endl;
	}
	return 0;
}
0