当前位置: 首页 > wzjs >正文

制作网站吗惠州住房和城乡建设厅网站

制作网站吗,惠州住房和城乡建设厅网站,网站qq启动链接怎么做,老实人做网站题目链接:https://codeforces.com/gym/105924 题目背景: 给出一个时间区间和当前时间,在时间区间内选择一个时间使得该时间与当前时间的时针夹角与分针夹角之和最小。 思路: 暴力枚举区间内的所有时间,计算与当前时间…
题目链接:https://codeforces.com/gym/105924
题目背景:

        给出一个时间区间和当前时间,在时间区间内选择一个时间使得该时间与当前时间的时针夹角与分针夹角之和最小。

思路:

       暴力枚举区间内的所有时间,计算与当前时间夹角的度数即可。

        注:由于时针上的一分钟为0.5度,需要取浮点数,可以将一圈定义为720度,这样一分钟就为1度。

数据范围:

        T <= 1e4。

时间复杂度:

        O(720T)

ac代码: 
#include <bits/stdc++.h>#define ioscc ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define endl '\n'
#define me(a, x) memset(a, x, sizeof a)
#define all(a) a.begin(), a.end()
#define sz(a) ((int)(a).size())
#define pb(a) push_back(a)
using namespace std;typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<bool> vb;const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, 1, 0, -1};
const int MAX = (1ll << 31) - 1;
const int MIN = 1 << 31;
const int MOD = 1e9 + 7;
const int N = 1e5 + 10;template <class T>
ostream &operator<<(ostream &os, const vector<T> &a) noexcept
{for (int i = 0; i < sz(a) - 10; i++)std::cout << a[i] << ' ';return os;
}template <class T>
istream &operator>>(istream &in, vector<T> &a) noexcept
{for (int i = 0; i < sz(a) - 10; i++)std::cin >> a[i];return in;
}/* ----------------- 有乘就强转,前缀和开ll ----------------- */void solve()
{int x0, y0, x1, y1, x2, y2;cin >> x0 >> y0 >> x1 >> y1 >> x2 >> y2;auto cost = [&](int a, int b) -> int{return min(abs(a - b), 720 - abs(a - b));};ll minn = MAX;ll ans1 = MIN, ans2 = MIN;int dh0 = x0 * 60 + y0;int dm0 = y0 * 12;int l = x1 * 60 + y1;int r = x2 * 60 + y2;for (int i = l; i <= r; ++i){int h = i / 60;int m = i % 60;int dh1 = h * 60 + m;int dm1 = m * 12;ll cnt = cost(dh0, dh1) + cost(dm0, dm1);if (cnt < minn || (cnt == minn && (h < ans1 || (h == ans1 && m < ans2)))){minn = cnt;ans1 = h;ans2 = m;}}cout << ans1 << ' ' << ans2 << endl;
}int main()
{ioscc;int T;cin >> T;while (T--)solve();return 0;
}

http://www.dtcms.com/wzjs/819714.html

相关文章:

  • 做暧小说在线观看网站网站建设和网站维护是什么
  • 产品工业设计网站wordpress 视频 缩略图
  • 做商城网站要多少钱番禺定制型网站建设
  • 免费招聘网站有哪些浙江网站建设服务
  • 南岸集团网站建设wordpress 管理员登陆
  • 山东建设局网站 王局2023年做网站怎么样
  • 网站的橱窗怎么做青岛酒巢网络科技有限公司
  • 电子商务网站排名气动科技东莞网站建设
  • 做软件下载网站怎么赚钱微信公众号免费模板网站
  • 企业网站建设合作协议范文网页设计视频
  • 做网站标签栏的图片大小泉州网站建设方案开发
  • 网站开发合同及报价单wordpress seo主题
  • 多少钱一个网站网站建设必要步骤
  • 建个人博客网站樱花动漫imomoe官网入口
  • 建设部人才网站智慧团建官网入口登录
  • 做网站费用 会计分录网站开发协义
  • 郑州建设网站费用在因特网上建设网站可选择的方案
  • 网站域名包括哪些多语言wordpress
  • 国内做网站最好的公司个人网站做哪种类型
  • 东莞网站的制作怎么把网站放到服务器上
  • 银川专业做网站新网站在谷歌上面怎么做推广
  • 网站开发平台软件新的网站建设技术方案
  • 深圳营销型网站定制网站建设公司清明雨上
  • 网站获取客户信息需要备案吗网站建设如何定位
  • 海南网络公司网站建设重庆哪里可以学习网站建设和维护
  • 单位的网站建设费如何核算国外做名片的网站
  • 网站在线建设网站开发中职教材
  • 网站 建设 申请报告免费网络推广网址
  • 什么是网络营销?如何理解它的产生和把握它的特点?东莞百度网站排名优化
  • 企业网站模板html下载idea的网站开发登录页面