随笔分类 - 哈希
摘要:题目链接:https://www.luogu.com.cn/problem/P1102 方法1:二分答案 #include<bits/stdc++.h> using namespace std; int n, c, a[200005]; long long ans; int main() { cin
阅读全文
摘要:题目链接:http://oj.tfls.net/p/176 题解:如果使用双重循环来查找,本题要超时。用哈希表来处理,定义a[x]代表x这个数在数列中是否存在,1代表存在,0代表,只需扫描1~x/2,若数字存在,那么只需要检查看x减去这个数的结果是否在数列里 #include<bits/stdc++
阅读全文
摘要:题目链接:https://www.luogu.com.cn/problem/P4305 方法一:哈希表 #include<bits/stdc++.h> using namespace std; const int P=10007; int t, n; vector <int> hs[P]; int
阅读全文
摘要:题目:Eqs 方法一:纯暴力 #include<iostream> using namespace std; int a1, a2, a3, a4, a5; int cnt; int main() { cin>>a1>>a2>>a3>>a4>>a5; for(int x1=-50; x1<=50;
阅读全文
摘要:https://www.luogu.com.cn/problem/P1059 洛谷地址 http://ybt.ssoier.cn:8088/problem_show.php?pid=1184 一本通地址 方法一:排序+去重 1 #include<cstdio> 2 #include<iostream
阅读全文