模拟构造
模拟,构造
剁diodio
这个作者很懒,什么都没留下…
展开
-
acwing 周赛31 4202. 穿过圆 bitset优化
题目描述: 题解: 因为两个点之间可以任意走,然后我们只用穿过包含该点的圆,那么答案就是就是两个点被包含的圆减点两个点都被包围的圆。 那如何快速求呢。这里我们用到了bitset,在第j个点的第i位为1,表示这个点被第j个圆包围,这样我们就可以就两个bitset做与操作快速求出他们共同包含的点了。然后预处理他们各自包含几个圆相减即可。 #include<bits/stdc++.h> using namespace std; const int N=1e4+5; typedef long long原创 2021-12-30 21:16:17 · 523 阅读 · 0 评论 -
TZOJ 4763: 线性表公共元素 list链表+模拟
题目: 题解: 本题直接用list模拟就完事了。 本人对list不是很熟练导致re两发。 代码: #include<bits/stdc++.h> using namespace std; int main() { int n; while(~scanf("%d",&n)) { list<int>l; int m; scanf("%d",&m); for(int i=1;i<=m;i++) { int k; scanf("%原创 2021-09-09 08:17:33 · 126 阅读 · 2 评论 -
Codeforces Round #741 (Div. 2) B - Scenes From a Memory 暴力打表
B - Scenes From a Memory 题目: 题解 题目的意思就是给你一串数,要求计算删掉多少数可以成为一个合数。 一开始看不出什么规律。于是我进行了暴力打表找规律。 暴力代码: #include<bits/stdc++.h> using namespace std; #define max 100 bool f=0; bool judge(int num) { for(int i=2;i*i<=num;i++) { if(num%i==0) { retur原创 2021-09-06 08:04:45 · 139 阅读 · 0 评论 -
hdu 7105 Power Sum 字符串构造
题目描述: 题解: 比赛中一直在dfs,bfs,打表找规律。一直没做出。比赛后看了别人代码,直接恍然大悟。 我们可以发现一下规律: 代码: #include<bits/stdc++.h> using namespace std; int main() { int t; scanf("%d",&t); while(t--) { string ss; int n; scanf("%d",&n);原创 2021-08-29 11:40:38 · 114 阅读 · 0 评论