結果
| 問題 | 
                            No.750 Frac #1
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-06-10 18:31:44 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 4 ms / 1,000 ms | 
| コード長 | 420 bytes | 
| コンパイル時間 | 2,536 ms | 
| コンパイル使用メモリ | 201,868 KB | 
| 最終ジャッジ日時 | 2025-01-11 00:48:22 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 30 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	int m=1;
	vector<pair<int,int>>ab(n);
	for(int i=0;i<n;++i){
		int a,b; cin>>a>>b;
		if(a<0)b*=-1;
		ab.at(i).second=a*10+b;
		m=lcm(m,b);
	}
	for(auto&&i:ab){
		i.first=m/(i.second%10)*abs(i.second/10);
	}
	sort(ab.rbegin(),ab.rend());
	for(auto&&i:ab)cout<<i.second/10<<" "s<<abs(i.second%10)<<"\n"s;
}