結果

問題 No.280 歯車の問題(1)
ユーザー kpinkcat
提出日時 2023-11-11 21:24:33
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 556 bytes
コンパイル時間 2,036 ms
コンパイル使用メモリ 192,408 KB
最終ジャッジ日時 2025-02-17 21:41:54
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<math.h>
#include<bitset>
using ll = long long;
using namespace std;

int main()
{
    ll n, grc = 1, grd = 1, gt;
    cin >> n >> gt;
    for (int i = 1; i < n; i++){
        ll t1, t2, g;
        cin >> t1;
        t2 = t1;
        g = gcd(gt, t1);
        gt /= g;
        t1 /= g;
        grc *= t1;
        grd *= gt;
        gt = t2;
    }
    cout << grc << "/" << grd << endl;
}
0