A 妙手 — 打表推导

#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
#define int long long
const int N = 200010 , mod = 1e18;
signed main()
{int a, b; cin >> a >> b;if(((a + b) & 1 ) && __gcd(a, b) == 1) cout << "Yes" << '\n';else cout << "No" << '\n';
}

B 宝石 — map优化

#include<iostream>
#include<algorithm>
#include<unordered_map>
using namespace std;
#define int long long
const int N = 2010;
int a[N];
signed main()
{int n; cin >> n;for(int i = 0; i < n; i ++) cin >> a[i];unordered_map<int,int>mp;for(int i = 0; i < n; i ++)for(int j = i; j < n; j ++)mp[a[i] * a[j]] = i;int res = 0;for(int i = 0; i < n; i ++)for(int j = i + 1; j < n; j ++)if(!a[j] && !a[i] || a[j] && a[i] % a[j] == 0 && mp[a[i] / a[j]] > i){res ++;break;}cout << res << '\n';
}

C 斩龙 — 模拟

#include<iostream>
using namespace std;
#define int long long
signed main()
{int a1, a2, a3, h1, h2, h3, k, x;cin >> a1 >> h1 >> a2 >> h2 >> x;cin >> k >> a3 >> h3;int res = 0;int sum = x - k;int cnt2 = (h2 + a1 - 1) / a1;if(sum > 0){res += cnt2 * sum;h1 -= (cnt2 - 1) * sum * a2;}k = min(x, k);res += cnt2 * k;h1 -= a3 * cnt2 * k;h1 -= a2 * (cnt2 - 1) * k;int cnt1 = (h3 + a1 - 1) / a1;res += cnt1;h1 -= (cnt1 - 1) * a3;if(h1 < 0) cout << "No Franxx!\n";else cout << res << '\n';}

D 数对 ---- 树状数组 + 推导

#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
#define int long long
const int N = 400010;int n, x, y;
int tr[N], s[N];
vector<int> nums;int find(int x)
{return lower_bound(nums.begin(), nums.end(),x) - nums.begin() + 1;
}
int lowbit(int x)
{return x & -x;
}void add(int x, int v)
{for(int i = x; i <= 2 * n + 2; i += lowbit(i)) tr[i] += v;
}int query(int x)
{int res = 0;for(int i = x; i; i -= lowbit(i)) res += tr[i];return res;
}signed main()
{cin >> n >> x >> y; for(int i = 1; i <= n; i ++){cin >> s[i];s[i] -= y;s[i] += s[i - 1];}for(int i = 0; i <= n; i ++){nums.push_back(s[i]);nums.push_back(s[i] - x - 1);}sort(nums.begin(),nums.end());nums.erase(unique(nums.begin(), nums.end()), nums.end());int res = 0;for(int i = 0; i <= n; i ++){res += query(2 * n + 2) - query(find(s[i] - x - 1));add(find(s[i]), 1);}cout << res << '\n';
}

E 双星 — 数学

#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
#define int long longconst double pi = acos(-1);struct circle {int x, y, r;double a, b;void input() { cin >> x >> y >> r; }void cal_ab(){ // 计算圆所占的极角序区间 [a, b]double mid = atan2(y, x), rad = asin(r / sqrt(x * x + y * y));a = mid - rad, b = mid + rad;}
};bool check_intersected(double a, double b, double c, double d){// 判断两个区间 [a, b], [c, d] 是否有交集return c < b && a < d;
}bool check_seeable(double a, double b, double c, double d){// 判断 [c, d] 在 [a, b] 的遮挡下是否能被看到;是返回 1,否则返回 0return c < a || d > b;
}circle c1, c2;signed main()
{c1.input(), c2.input();c1.cal_ab(), c2.cal_ab();if(c1.x * c1.x + c1.y * c1.y > c2.x * c2.x + c2.y * c2.y)swap(c1, c2); // 靠近原点的圆作为 c1for(double dt : {0.0, -2 * pi, 2 * pi}){double a = c1.a, b = c1.b, c = c2.a + dt, d = c2.b + dt;if(check_intersected(a, b, c, d)){if(check_seeable(a, b, c, d)) cout << "Yes";else cout << "No";return 0;}}cout << "Yes";}

F 手办 — 签到

#include<iostream>
#include<vector>
using namespace std;
#define int long long
signed main()
{vector<int>vec;for(int i = 1; i <= 1000; i ++) vec.push_back(i*i*i);int T; cin >> T;while(T --){int n; cin >> n;int res = 0;for(int i = 1; i <= 1000; i ++)if(n % vec[i - 1] == 0) res ++;cout << res << '\n';}
}

G 无限 — dp

#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
#define int long long
const int N = 2000010 , mod = 998244353;
int f[N];
signed main()
{int n; cin >> n;f[1] = 1;for(int i = 2; i <= n; i ++) f[i] = (f[i - 1] + f[i - 2]) % mod;int res = 0;for(int i = 1; i <= n; i ++) res = (res + f[i]) % mod;cout << res << '\n';
}

H 0和1 — 贪心

#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
#define int long long
const int N = 200010 , mod = 1e18;string s;
int cal(char op)
{vector<pair<int,int> > vec;int res = 0;for(int i = 0; i < s.size(); i ++){if(s[i] == op){int j = i;while(s[j] == s[i]) j ++;j --;if(vec.size() && j - i + 1 + vec.back().second - vec.back().first + 1 >= 3 && vec.back().second + 2 == i){res ++;vec.back().second = j;}else vec.push_back({i, j});i = j;}}for(auto [l, r] : vec)if(r - l + 1 >= 2) res += 2;else res ++;return res;
}signed main()
{cin >> s;cout << min(cal('0'), cal('1')) << '\n';
}

I 22数 — 数位dp / dfs暴搜

数位dp

#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
#define int long long
const int N = 200010 , mod = 1e18;
int n;
int f[11][11][110];
// 前 i 位 第 i 位为 j,数字之和 为 k的 数的个数
// f[i][j][k] += f[i - 1][u][k - j];void init()
{for(int i = 0; i <= 9; i ++) f[1][i][i] = 1;for(int i = 2; i <= 10; i ++)for(int j = 0; j <= 9; j ++)for(int k = j; k <= 90; k ++)for(int u = 0; u <= 9; u ++)f[i][j][k] += f[i - 1][u][k - j];
}int cal(int n)
{vector<int> nums;while(n) nums.push_back(n % 10), n /= 10;int res = 0, sum = 0, len = nums.size();for(int i = nums.size() - 1; i >= 0; i --){int x = nums[i];for(int j = i == nums.size() - 1; j < x; j ++)res += f[i + 1][j][len * 2 - sum];sum += x;if(sum > len * 2) break;if(!i && sum == len * 2) res ++;}for(int i = 1; i < len; i ++)for(int j = 1; j <= 9; j ++)res += f[i][j][2 * i];   return res;
}signed main()
{init();cin >> n;cout << cal(n) << '\n';
}

暴搜

#include<iostream>
using namespace std;
#define int long long
int n, res = 0;
void dfs(int x, int sum, int cnt)
{if(x > n || sum > 20) return ;if(cnt && sum == cnt * 2) res ++;for(int i = 0; i <= 9; i ++){int y = x * 10 + i;if(y) dfs(y, sum + i, cnt + 1);}
}
signed main()
{cin >> n;dfs(0,0,0);cout << res << '\n';
}

J 签到 — 签到

#include<iostream>
#include<set>
using namespace std;
#define int long long
const int N = 1010;
int a[N];
signed main()
{int n; cin >> n;for(int i = 0; i < n; i ++) cin >> a[i];set<int> S;for(int i = 0; i < n; i ++)for(int j = 0; j < n; j ++)S.insert(a[i] + a[j]);for(int i = 0; i < n; i ++)for(int j = 0; j < n; j ++)if(S.count(a[i] - a[j])){cout << "Yes" << '\n';return 0;}cout << "No" << '\n';
}

K 大米 — 线段树

#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
#define int long long
const int N = 200010 , mod = 1e18;
int n, m;
int w[N];
struct node
{int l, r;int os, es;int tag;
}tr[N << 2];void pushup(node &u, node &l, node &r)
{u.os = l.os + r.os;u.es = l.es + r.es;
}void pushup(int u)
{pushup(tr[u], tr[u << 1], tr[u << 1 | 1]);
}void pushtag(int u)
{int tmp = tr[u].es;tr[u].es = tr[u].os * 2;tr[u].os = tmp / 2;tr[u].tag ^= 1;
}void pushdown(int u)
{if(tr[u].tag){pushtag(u << 1);pushtag(u << 1 | 1);tr[u].tag = 0;}
}void build(int u, int l, int r)
{tr[u] = {l, r};if(l == r){tr[u].os = w[l];return ;}int mid = l + r >> 1;build(u << 1, l, mid);build(u << 1 | 1, mid + 1, r);pushup(u);}void modify(int u, int l, int r)
{if(tr[u].l >= l && tr[u].r <= r)return pushtag(u);int mid = tr[u].l + tr[u].r >> 1;pushdown(u);if(l <= mid) modify(u << 1, l, r);if(r > mid) modify(u << 1 | 1, l, r);pushup(u);
}signed main()
{ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin >> n >> m;for(int i = 1; i <= n; i ++) cin >> w[i];build(1, 1, n);while(m --){int l, r; cin >> l >> r;modify(1, l, r);cout << tr[1].os + tr[1].es << '\n';}
}

L HPU — 签到

#include<iostream>
#include<cstring>
using namespace std;
signed main()
{string s; cin >> s;int res = 0;if(s.size() < 3){cout << 0 << '\n';return 0;}for(int i = 0; i + 2 < s.size(); i ++)if(s[i] == 'H' && s[i + 1] == 'P' && s[i + 2] == 'U') res ++;cout << res << '\n';
}

2022河南联赛第(二)场:河南理工大学 ---复盘相关推荐

  1. 2020年河南高考--各高校在河南录取分数线预测(本科二批——文科)

    转载请注明出处:https://blog.csdn.net/zhanglei1234567890/article/details/107667006 由于学校总多,闲暇之余所写,只有各高校在河南的录取 ...

  2. 2020年河南高考--各高校在河南录取分数线预测(本科二批——理科):

    转载请注明出处:https://blog.csdn.net/zhanglei1234567890/article/details/107666861 由于学校总多,闲暇之余所写,只有各高校在河南的录取 ...

  3. 河南理工计算机面试题,河南理工大学自主招生面试试题综合素质答案技巧

    河南理工大学自主招生面试试题与答题技 巧 一.河南理工大学综合素质测试目的 综合素质测试面试主要从学科潜质.人文素养.科学思维.个性特长和心理素质等多个维度来考察报考的学生. 二.河南理工大学综合素质 ...

  4. 河南淅川高考成绩查询2021,2021年河南高考成绩查询网址,河南高考成绩查询系统时间安排...

    2020年河南高考结束后高考分数线什么时候公布呢,今年河南高考工作相比往年整体推迟一个月,高考成绩查询时间.高考录取分数线公布时间.高考志愿填报时间.高考录取时间也相应的推迟一个月,本文高考升学网小编 ...

  5. 河南城建学院计算机分数,河南城建学院录取分数线2021是多少分(附历年录取分数线)...

    河南城建学院录取分数线2020是多少分,各专业录取分数线是多少,是每个填报河南城建学院的考生最关注的问题,随着各省高考录取批次相继公布,考生也开始关心是否被录取,本站小编整理相关信息供参考,仅供参考. ...

  6. hdu区域赛在线热身赛 暨 第十二场组队赛

    题目编号:hdu 4257~4266 (对应比赛题号1001~1010) 这是我们第十二场组队赛,在今天中午进行. 比赛刚开始,依然是由我的队友读题.还没看几题,就发现了好多题judge时长高达20秒 ...

  7. 河南科技大学计算机系宿舍,河南科技大学宿舍条件怎么样—河南科技大学宿舍图片...

    河南科技大学宿舍条件怎么样-河南科技大学宿舍图片 大学宿舍就是我们的第二个家,河南科技大学条件怎么样也就成了同学们选大学时十分关心的问题,为了更全面更真实地了解河南科技大学宿舍条件,我们来看一下生活在 ...

  8. 河南师范大学计算机学院地址,河南师范大学校区有几个 地址是什么

    河南师范大学有2个校区,分别是东校区和西校区,两个校区之间仅隔了一条马路,地址是河南省新乡市建设东路46号. 河南师范大学简介 河南师范大学坚持立德树人,教育教学成果丰硕,是国家卓越教师培养计划.国家 ...

  9. 2022年大中华区最佳职场榜单公布,共有92家企业入选 | 美通社头条

    美通社消息:在大中华区对于超过14万名员工发出邀请并且得到反馈之后,Great Place to Work(卓越职场) 依据参选企业的信任指数和职场文化审计结果,发布2022年"大中华区最佳 ...

  10. 2022年亚洲最佳职场榜单公布,排名前30的跨国公司是这些 | 美通社头条

    美通社消息:Great Place to Work(卓越职场)公布了2022年亚洲最佳职场(Best Workplaces in Asia)榜单.该榜单是根据在亚洲和中东收到的100多万份调研回应选出 ...

最新文章

  1. Windows7防火墙服务无法启用怎么办
  2. hdu1051 Wooden Sticks
  3. 手机内存解读以及android刷机原理
  4. Servlet_执行原理
  5. 远程办公的一天:魔幻24小时
  6. python脚本语言采用声音作为手段_LKJ自动化测试脚本定义及生成技术研究
  7. java 程序输出 赵_编写一个完整的JAVA的程序
  8. Discuz在Firefox下无法切换至编辑器状态解决(Z)
  9. three相机在模型上_实例讲解Three.js加载外部模型
  10. 基于JAVA+SSH+MYSQL的水果商城系统
  11. 程序员专属段子集锦 7/10
  12. 帧差法matlab代码_【游戏流体力学基础及Unity代码(一)】热传导方程
  13. 容灾技术中的数据一致性保障
  14. [LeetCode]Rotate List
  15. 全国计算机城市排名,这五大城市教育资源全国领先,各城市优质高校排行榜一定要收藏!...
  16. Mac pro 安装ubuntu系统
  17. onkeyup+onafterpaste 只能输入数字和小数点
  18. 使用Python 绘制双Y轴和误差棒柱状图
  19. java获取useragent_Java获取访问者的userAgent,系统和浏览器版本
  20. 1、乐趣国学——“君子不器”

热门文章

  1. Python进阶(十八)Python3爬虫小试牛刀
  2. java 浏览器测试,【Java资源大全】Selenium:基于浏览器的测试套件
  3. GPU-CUDA编程学习(四)-共享内存
  4. 鸿蒙系统升级到第几批了,鸿蒙系统第四批升级名单有哪些 鸿蒙系统第四批升级机型介绍...
  5. c语言学习2(求矩形面积)
  6. 编程实现linux中的who命令功能,Linux who命令简介及使用方法详解
  7. 用NDK-r25编译libpng
  8. pacemaker+nginx+iscsi实现的nginx服务远程储存高可用
  9. hashmap面试题,音视频学习指南来咯,社招面试心得
  10. 人工智能——归结推理