結果
問題 |
No.751 Frac #2
|
ユーザー |
|
提出日時 | 2019-03-15 15:51:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 510 bytes |
コンパイル時間 | 2,246 ms |
コンパイル使用メモリ | 193,196 KB |
最終ジャッジ日時 | 2025-01-06 22:10:37 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 WA * 9 |
ソースコード
#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 % 2 == 1) nume *= x; else denm *= x; } cout << nume / __gcd(nume, denm) << " " << denm / __gcd(nume, denm) << endl; return 0; }