結果
問題 |
No.1501 酔歩
|
ユーザー |
|
提出日時 | 2021-05-08 13:20:37 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 734 bytes |
コンパイル時間 | 732 ms |
コンパイル使用メモリ | 73,072 KB |
最終ジャッジ日時 | 2025-01-21 09:16:16 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 WA * 13 |
ソースコード
#include <iostream> #include <numeric> #include <vector> using namespace std; using lint = long long; constexpr lint G = 6350400; // LCM(1,2,...,10)^2 void solve() { int n, k; cin >> n >> k; --k; if (k == 0) { cout << "0\n"; return; } vector<lint> xs(n); for (auto& x : xs) cin >> x; lint num = 0, dom = 0; for (int i = 1; i <= k; ++i) { num += G / xs[i] / xs[i - 1]; } for (int i = 1; i < n; ++i) { dom += G / xs[i] / xs[i - 1]; } { auto g = gcd(num, dom); num /= g, dom /= g; } cout << num << "/" << dom << "\n"; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); solve(); return 0; }