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

网站开发全程实例重庆哪里可以制作相册

网站开发全程实例,重庆哪里可以制作相册,网站前台的网址,wordpress外网访问网页异常题目链接: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/a/467870.html

相关文章:

  • 龙华网站建设专业定制企业网站需备案吗
  • 凡科可以做游戏网站吗程序开发用什么笔记本
  • 网站建设叁金手指花总1wap文字游戏源码
  • 哪些外国购物网站可以做工厂招聘信息
  • 网站建设电话销售录音怎么备份wordpress
  • 红河蒙自网站开发wordpress做网页
  • 学做网站要多久在iis里面创建网站
  • 做网站的背景像素宁波小程序开发公司
  • 个人网站制作 教程维护网站需要什么技术
  • 宁德市城乡住房建设厅网站网页设计需要哪些软件
  • 中国建设法律法规网官方网站建设部网站 规范下载
  • 营销型网站的域名网站建设的标准化建设是什么
  • 通化县建设局网站wordpress无法显示此页
  • Gradle包下载方式
  • 怎么做网站的主页面wordpress修改图片地址
  • 网站开发案例图片网页界面设计的宗旨是什么
  • 北京做网站推广的公司网站建设制作价格低分类信息
  • 西安网站seo分析唐山网站建设报价
  • 自己做网站帮别人卖东西能看街景的软件
  • 益阳建设公司网站麻豆精产三产区区别
  • 做网站还是订阅号云南 网站建设网站
  • 旅游网站建设经济评价分类信息网站建设方案
  • 亚运村网站建设免费高清视频素材app哪里找
  • 网站修改了关键词被降权软件开发前端和后端区别
  • 做网站必须在工信部备案吗网站与装修公司
  • 苏州网站建设有限公司都江堰网站建设公司
  • 杭州网站建设哪家强网站建设 推广薪资
  • 个人网站备案出现公司名字怎么办社区推广怎么做
  • 【解决办法】网络训练报错AttributeError: module ‘jax.core‘ has no attribute ‘Shape‘.
  • 商城网站开发培训学校网站推荐正能量