結果
| 問題 |
No.1501 酔歩
|
| コンテスト | |
| ユーザー |
trineutron
|
| 提出日時 | 2021-05-07 22:03:11 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 734 bytes |
| コンパイル時間 | 1,996 ms |
| コンパイル使用メモリ | 195,600 KB |
| 最終ジャッジ日時 | 2025-01-21 08:10:12 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 WA * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, k;
cin >> n >> k;
assert(1 <= k and k <= n and n <= 100000);
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;
if (p == 0)
{
cout << 0 << endl;
}
else
{
cout << p << '/' << q << endl;
}
return 0;
}
trineutron