AtCoder Beginner Contest 168 C

时间:2022-07-24
本文章向大家介绍AtCoder Beginner Contest 168 C,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

昨晚做这个时钟的题,真的是,做的我吐了,忘了考虑几小时几分钟的时候,不是对应在整数点的,而是有偏差的

#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <bits/stdc++.h> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> Pl;
typedef pair<int, int> P;
#include <cmath>

int main()
{
  double A, B, H, M, ans, tmp, ang1, ang2;
  cin >> A >> B >> H >> M;
  ang1 = 6.0 * M;
  ang2 = 30.0 * H + 0.5 * M;
  tmp = (A * A) + (B * B) - (2 * A * B) * cos(abs(ang1 - ang2) * M_PI / 180);
  ans = sqrt(tmp);
  cout << fixed;
  cout << setprecision(20) << ans << endl;
  return 0;
}