結果

問題 No.750 Frac #1
ユーザー newlife171128
提出日時 2019-05-07 05:45:05
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 747 bytes
コンパイル時間 1,555 ms
コンパイル使用メモリ 166,584 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-01 23:26:35
合計ジャッジ時間 2,619 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

const long long INF = 1LL << 60;
#define MOD 1000000007;

typedef long long ll;

#define writeln(n) cout<<n<<endl;

typedef pair<float, float> P;

typedef pair<string, int> Psi;

int d[15];
int main() {

	int n;
	cin>>n;

	vector<P> v;

	for(int i=0; i<n; i++){
		float a,b;
		cin>>a>>b;

		v.push_back(P(a,b));

	}
	vector<float> p;

	for(int i=0; i<v.size(); i++){
		p.push_back(v[i].first/v[i].second);
	}

	sort(p.begin(),p.end(),greater<float>());

	for(int i=0; i<n; i++){
		if(d[i])continue;
		float t = p[i];
		/*int index=i;*/
		for(int j=0; j<n; j++){
			/*if(d[j])continue;*/
			if(v[j].first/v[j].second ==t){
				cout<<v[j].first<<" "<<v[j].second<<endl;
				break;
			}

		}


	}
}





0