前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >AtCoder Beginner Contest 168 C

AtCoder Beginner Contest 168 C

作者头像
杨鹏伟
发布2020-09-11 15:12:19
3020
发布2020-09-11 15:12:19
举报
文章被收录于专栏:ypw

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

代码语言:javascript
复制
#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;
}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020/05/18 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档