当前位置:网站首页>两日总结八
两日总结八
2022-08-04 06:03:00 【JSU-YSJ】
总结时间2022/7/30-8/1
比赛总结:这两天一共打了两场比赛
蔚蓝杯4:


其中只要是N题目,比赛的时候一直耗着,就是因为一个int128的使用,要使用快读快写,还有就是GCD里面也要修改。这一场没有报0了,主要就是死磕N题目去了,换了几种写法,分数加减都试了,然后公式也简化了,但是就是数据范围long long 差了那么一点,然后其他的题目没心情怎么去想,反正就是没有一点状态!!!就是下面这个题目:
#include <bits/stdc++.h>
using namespace std;
#define re // register
#define ll __int128
#define OST ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define endl "\n"
ll cnt[16], a[100005];
ll n;
inline int read() {
re int t = 0;
re char v = getchar();
while (v < '0') v = getchar();
while (v >= '0') t = (t << 3) + (t << 1) + v - 48, v = getchar();
return t;
}
inline __int128 gcd(__int128 x, __int128 y) { return y ? gcd(y, x % y) : x; }
inline void write(__int128 x) {
if (x > 9) write(x / 10);
putchar(x % 10 + '0');
}
pair<ll, ll> add(pair<ll, ll> a, pair<ll, ll> b) {
ll tmp = a.second / gcd(a.second, b.second) * b.second;
a.first = tmp / a.second * a.first;
b.first = tmp / b.second * b.first;
pair<ll, ll> res;
res.first = a.first + b.first;
res.second = tmp;
tmp = gcd(res.first, res.second);
res.first /= tmp;
res.second /= tmp;
return res;
}
int main() {
OST;
n = read();
for (int i = 1; i <= n; i++) {
a[i] = read();
for (int j = 0; j < 15; j++) {
if (a[i] & (1 << j)) { cnt[j]++; }
}
}
vector<ll> num;
for (int i = 1; i <= n; i++) {
ll tmp = 0;
for (int j = 0; j < 15; j++) {
if (cnt[j]) {
cnt[j]--;
tmp += (1 << j);
}
}
num.push_back(tmp);
}
ll pingfenzi = 0, pingfenmu = n;
for (int i = 0; i < n; i++) { pingfenzi += num[i]; }
ll tmp;
tmp = gcd(pingfenzi, pingfenmu);
pingfenzi /= tmp;
pingfenmu /= tmp;
pair<ll, ll> b = {-pingfenzi, pingfenmu};
pair<ll, ll> ans = {0, 0};
for (int i = 0; i < n; i++) {
pair<ll, ll> c = {num[i], 1};
pair<ll, ll> res = add(c, b);
res.first *= res.first;
res.second *= res.second;
res.second *= n;
if (i == 0)
ans = res;
else
ans = add(ans, res);
// cout << ans.first << " " << ans.second << endl;
}
tmp = gcd(ans.first, ans.second);
ans.first /= tmp;
ans.second /= tmp;
write(ans.first);
putchar('/');
write(ans.second);
return 0;
}
蔚蓝杯5:
这场没有什么说的,不算,其中要不是简单题目,要不就是洛谷上面的原题。唯一一点收获就是F题目吧,想法十分的简单,就是从上往下看能看到的多个圆的周长,洛谷题下落圆,这里就是要计算出一个圆被其他圆遮住的部分,而且不要算重复(这点就是比较难处理),可以用线段树,更好的方法就是用极角,计算得到被遮住的L_R两个范围,遍历其他所有圆更新这个范围。比他小的时就跳过,超过范围的就是更新更大的遮挡区间即可,最后排序用所有圆的周长减去这些遮住的即可。
#include <bits/stdc++.h>
using namespace std;
#define pair pair<double, double>
const int N = 1e3 + 5;
const double eps = 1e-7;
double x[N], y[N], r[N];
const double PI = acos(-1);
int n;
double funPow(double tmp) { return (double) (tmp * tmp); }
double dist(double x1, double y1, double x2, double y2) { return sqrt(funPow(x2 - x1) + funPow(y2 - y1)); }
double reduce(double x) {
x += PI * 2, x = x - (int) (x / (PI * 2)) * (PI * 2);
return x;
}
int main() {
while (cin >> n && n) {
vector<pair> p;
double res = 0.0;
for (int i = 1; i <= n; i++) cin >> x[i] >> y[i] >> r[i];
for (int i = 1; i <= n; i++) {
p.clear();
for (int j = i + 1; j <= n; j++) {
double d = dist(x[i], y[i], x[j], y[j]);
if (d >= r[i] + r[j] - eps) continue;
if (d <= fabs(r[i] - r[j]) + eps) {
if (r[j] > r[i]) { p.push_back({0, 2 * PI}); }
continue;
}
double tmp = (d - (funPow(r[j]) - funPow(r[i])) / d) / 2;
double jiao = acos(tmp / r[i]);
double zhong = reduce(atan2(x[i] - x[j], y[i] - y[j]) + PI / 2);
double L = reduce(zhong - jiao), R = reduce(zhong + jiao);
// cout << L << " " << zhong << " " << R << endl;
if (L - eps > R) {
p.push_back({L, 2 * PI});
p.push_back({0.0, R});
} else {
p.push_back({L, R});
}
};
sort(p.begin(), p.end());
res += 2 * PI * r[i];
double LL = 0, RR = 0;
for (int j = 0; j < (int) p.size(); j++) {
if (p[j].first > RR) {
res -= (RR - LL) * r[i];
LL = p[j].first;
}
RR = max(RR, p[j].second);
}
res -= (RR - LL) * r[i];
}
printf("%.10lf\n", res);
}
return 0;
}然后就是其他的刷题:
这一场的补题:


然后就是额外刷题目最近一直在刷CF1600-1700的题目,主要是感觉这次暑假的训练都是偏向思维还有数论,所以刷刷CF题目:

边栏推荐
- Computer software: recommend a disk space analysis tool - WizTree
- Implementation of ICEEMDAN Decomposition Code in MATLAB
- 对象的扩展补充
- 错误记录:TypeError: object() takes no parameters
- unity webgl报 Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON
- 事件链原理,事件代理,页面的渲染流程,防抖和节流,懒加载和预加载
- Interpretation of EfficientNet: Composite scaling method of neural network (based on tf-Kersa reproduction code)
- MMDeploy部署实战系列【第四章】:onnx,tensorrt模型推理
- Gramm Angle field GAF time-series data into the image and applied to the fault diagnosis
- Detailed ResNet: What problem is ResNet solving?
猜你喜欢

电商系统PC商城模块介绍

基于爬行动物搜索RSA优化LSTM的时间序列预测

A priori box (Anchor) in target detection

mysql:列类型之float、double

反射与枚举

基于子空间结构保持的迁移学习方法MLSSM

Database knowledge: SQLServer creates non-sa user notes

Error ER_NOT_SUPPORTED_AUTH_MODE Client does not support authentication protocol requested by serv

Based on the EEMD + + MLR GRU helped time series prediction

自适应迁移学习核极限学习机用于预测
随机推荐
窥探晶体世界的奥秘 —— 230种空间群晶体结构模型全在这里
HbuilderX 启动微信小程序 无法打开项目
npm包发布与迭代
ThreadLocal内存泄漏问题讲解
SQL如何从字符串截取指定字符(LEFT、MID、RIGHT三大函数)
Microsoft computer butler 2.0 beta experience
A priori box (Anchor) in target detection
unity 循环选择器
Base64编码原理
mysql:列类型之float、double
如何用matlab做高精度计算?【第二辑】
Database Skills: Organize SQL Server's Very Practical Scripts
ubuntu18.04安装redis教程
【C# - 爬虫】使用Selenium实现爬虫,获取近七天天气信息(包含完整代码)
MATLAB版量化交易技术分析工具TA-Lib【不付费也可获取,不要被付费吓跑】
西门子PLC1200与fanuc机器人进行profibus通讯
核心价值观编码器【matlab版】
“需求370解决解决爬取章节之后主题讨论评论消失问题”工作总结
IDEA 控制台 中文乱码问题(如果网上教程都无法解决你的问题的话)
Based on the EEMD + + MLR GRU helped time series prediction