結果

問題 No.3073 Fraction Median
ユーザー snrnsidy
提出日時 2025-03-21 23:17:01
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 444 bytes
コンパイル時間 2,392 ms
コンパイル使用メモリ 198,816 KB
実行使用メモリ 13,508 KB
最終ジャッジ日時 2025-03-21 23:17:11
合計ジャッジ時間 8,579 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int gcd(int a,int b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,t;
    vector <int> v;

    cin >> n;
    for(int i=0;i<n;i++)
    {
        cin >> t;
        v.push_back(t);
    }

    sort(v.rbegin(),v.rend());

    int g = gcd(v[0],v[1]);

    cout << v[1]/g << ' ' << v[0]/g << '\n';

    return 0;   
}
0