結果
問題 | No.926 休日の平均 |
ユーザー |
![]() |
提出日時 | 2019-11-22 21:48:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 1,016 bytes |
コンパイル時間 | 820 ms |
コンパイル使用メモリ | 96,312 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-11 03:17:22 |
合計ジャッジ時間 | 1,698 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
ソースコード
#include <iostream>#include <vector>#include <algorithm>#include <iomanip>#include <string>#include <stack>#include <queue>#include <map>#include <set>#include <tuple>#include <cstdio>#include <cstdlib>#include <cmath>#include <climits>#include <cassert>#include <cstdint>#include <numeric>#include <bitset>#include <functional>using namespace std;using ll = long long;using Pll = pair<ll, ll>;using Pii = pair<int, int>;constexpr ll MOD = 1000000007;constexpr long double EPS = 1e-10;constexpr int dyx[4][2] = {{ 0, 1}, {-1, 0}, {0,-1}, {1, 0}};ll gcd(ll a, ll b){if(b == 0) return a;else return gcd(b, a%b);}ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}int main() {ios::sync_with_stdio(false); cin.tie(nullptr);int a, b, c;cin >> a >> b >> c;int l = lcm(a, b);int holidays = 0;for(int i=0;i<l;++i) {if(i % b < c) ++holidays;}cout << setprecision(10) << fixed << double(holidays) / double(l/a) << endl;}