結果
問題 | No.750 Frac #1 |
ユーザー | rtia_iidx |
提出日時 | 2018-11-09 21:26:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 881 bytes |
コンパイル時間 | 994 ms |
コンパイル使用メモリ | 106,720 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-21 05:32:37 |
合計ジャッジ時間 | 1,867 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include<iostream> #include<vector> #include<algorithm> #include<functional> #include<queue> #include<stack> #include<set> #include<map> #include<unordered_map> #include<climits> #include<cstdlib> #include<cmath> #include<string> #include<iomanip> #include<bitset> using namespace std; #define INF 1 << 29 #define LL long long int LL const MOD = 1000000007; int main(){ cin.tie(0); ios::sync_with_stdio(false); LL n; cin >> n; vector<pair<LL,LL>> x; LL y = 1; for(int i = 0; i < n; i++){ LL a,b; cin >> a >> b; x.push_back(make_pair(a,b)); y *= b; } for(int i = 0; i < n; i++){ x[i].first *= (y/x[i].second); } sort(x.begin(),x.end()); for(int i = n-1; i >= 0; i--){ cout << x[i].first/((y/x[i].second)) << " "; cout << x[i].second << endl; } return 0; }