結果

問題 No.1501 酔歩
ユーザー trineutrontrineutron
提出日時 2021-05-08 00:08:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 839 bytes
コンパイル時間 1,960 ms
コンパイル使用メモリ 201,480 KB
実行使用メモリ 4,484 KB
最終ジャッジ日時 2023-10-13 16:16:30
合計ジャッジ時間 7,974 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 1 ms
4,352 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,352 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 1 ms
4,352 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 AC 19 ms
4,348 KB
testcase_43 AC 2 ms
4,348 KB
testcase_44 AC 1 ms
4,348 KB
testcase_45 AC 14 ms
4,352 KB
testcase_46 AC 15 ms
4,348 KB
testcase_47 AC 14 ms
4,352 KB
testcase_48 AC 16 ms
4,352 KB
testcase_49 AC 16 ms
4,348 KB
testcase_50 AC 16 ms
4,352 KB
testcase_51 AC 16 ms
4,348 KB
testcase_52 AC 16 ms
4,348 KB
testcase_53 AC 1 ms
4,352 KB
testcase_54 AC 1 ms
4,348 KB
testcase_55 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    assert(1 <= k and k <= n and n <= 100000);
    if (n == 1)
    {
        cout << "1/1" << endl;
        return 0;
    }
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i);
        assert(1 <= a.at(i) and a.at(i) <= 10);
    }
    const int root = 2520 * 2520;
    vector<int> d(n - 1);
    for (int i = 0; i < n - 1; i++)
    {
        d.at(i) = root / (a.at(i) * a.at(i + 1));
    }
    int64_t p = accumulate(d.begin(), d.begin() + k - 1, int64_t()), q = accumulate(d.begin(), d.end(), int64_t());
    int64_t g = gcd(p, q);
    p /= g;
    q /= g;
    assert(q < 1000000007);
    if (p == 0)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << p << '/' << q << endl;
    }
    return 0;
}
0