結果
| 問題 | 
                            No.751 Frac #2
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-03-15 15:49:55 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 506 bytes | 
| コンパイル時間 | 2,216 ms | 
| コンパイル使用メモリ | 192,548 KB | 
| 最終ジャッジ日時 | 2025-01-06 22:10:28 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 8 WA * 28 | 
ソースコード
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  long long nume = 1, denm = 1;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (i == 0) nume *= x;
    else denm *= x;
  }
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (i != 0) nume *= x;
    else denm *= x;
  }
  cout << nume / __gcd(nume, denm) << " " << denm / __gcd(nume, denm) << endl;
  return 0;	
}