
hash
lcxdz
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
L2-005 集合相似度 (25 分) (思维 hash
添加链接描述 #include<bits/stdc++.h> using namespace std; const int N=55; vector<int>v[N]; unordered_map<int,int>s[N],sum[N]; int main(){ std::ios::sync_with_stdio(0); cin.tie(0),cout.tie(0); int n; cin>>n; for(int i=1;i<=n;原创 2022-04-15 15:23:10 · 124 阅读 · 0 评论 -
试题 D: 货物摆放
试题 D: 货物摆放 本题总分:10 分 【问题描述】 小蓝有一个超大的仓库,可以摆放很多货物。 现在,小蓝有 n 箱货物要摆放在仓库,每箱货物都是规则的正方体。小蓝 规定了长、宽、高三个互相垂直的方向,每箱货物的边都必须严格平行于长、 宽、高。 小蓝希望所有的货物最终摆成一个大的长方体。即在长、宽、高的方向上 分别堆 L、W、H 的货物,满足 n = L × W × H。 给定 n,请问有多少种堆放货物的方案满足要求。 例如,当 n = 4 时,有以下 6 种方案:1×1×4、1×2×2、1×4×1、2.原创 2022-04-07 19:53:10 · 134 阅读 · 0 评论 -
试题 C: 直线 (模拟 hash
#include<bits/stdc++.h> using namespace std; typedef pair<double,double> pii; map<pii,int>mp; int ans=0; int main(){ int a,b; cin>>a>>b; for(int x1=0;x1<=a;x1++){ for(int y1=0;y1<=b;y1++){ .原创 2022-04-07 19:47:16 · 339 阅读 · 0 评论 -
1204. 错误票据 (hash
添加链接描述 #include<bits/stdc++.h> using namespace std; const int N=1e5+9; int arr[N]; int main(){ int n; cin>>n; int mi=1e9,mx=0; while(cin>>n){ arr[n]++; mi=min(mi,n); mx=max(mx,n); } int a,b;原创 2022-04-04 18:33:38 · 252 阅读 · 0 评论 -
剪绳子 (思维 hash
添加链接描述 #include<bits/stdc++.h> using namespace std; set<double> mp; int main(){ int n; cin>>n; mp.insert(0.0),mp.insert(10.0); while(n--){ string s; cin>>s; double x; cin>>x;原创 2022-03-27 14:32:02 · 125 阅读 · 0 评论 -
1221. 四平方和 (hash
添加链接描述 1221. 四平方和 题目 提交记录 讨论 题解 视频讲解 四平方和定理,又称为拉格朗日定理: 每个正整数都可以表示为至多 4 个正整数的平方和。 如果把 0 包括进去,就正好可以表示为 4 个数的平方和。 比如: 5=02+02+12+22 7=12+12+12+22 对于一个给定的正整数,可能存在多种平方和的表示法。 要求你对 4 个数排序: 0≤a≤b≤c≤d 并对所有的可能表示法按 a,b,c,d 为联合主键升序排列,最后输出第一个表示法。 输入格式 输入一个正整数 N。 输出格式 输原创 2022-03-25 15:16:22 · 121 阅读 · 0 评论 -
7-1 Fake News (20 分) (排序 hash
添加链接描述 注意unordered_map 测试点2 #include<bits/stdc++.h> using namespace std; const int N=1e4+9; int arr[N]; int res[N]; typedef pair<int,int> pii; bool cmp(pii a,pii b){ return a.second>b.second; } int main(){ int n,m; ci原创 2022-02-27 16:52:02 · 167 阅读 · 0 评论 -
1157 Anniversary (25 分) (hash
添加链接描述 #include<bits/stdc++.h> using namespace std; map<string,int> mp; int main(){ int n; cin>>n; int ok=1; string ans; for(int i=1;i<=n;i++){ string a; cin>>a; mp[a]++; }原创 2022-02-26 18:33:43 · 175 阅读 · 0 评论 -
1145 Hashing - Average Search Time (25 分) (hash 平均探测时间
添加链接描述 j从0到k,k为质数 最后除要得除到k #include<bits/stdc++.h> using namespace std; bool is(int n){ if(n<=1)return 0; for(int i=2;i<=n/i;i++){ if(n%i==0)return 0; } return 1; } int main(){ int t,n,m; cin>>t>>n&g原创 2022-02-23 21:36:15 · 126 阅读 · 0 评论 -
1141 PAT Ranking of Institutions (25 分) (结构体排序 hash
添加链接描述 注意这题是先统计和 然后再向下取整 #include<bits/stdc++.h> using namespace std; const int N=1e5+9; struct node { string sch; int score; int num; }t[N]; map<string,int>tot_sch; map<string,int>tot_name; typedef pair<string,int> pii; map&原创 2022-02-23 16:47:04 · 72 阅读 · 0 评论 -
1121 Damn Single (25 分)(编号记得%05d set hash
添加链接描述 #include<bits/stdc++.h> using namespace std; const int N=1e6+9; int arr[N],num[N]; int gu[N]; set<int>ans; int main(){ std::ios::sync_with_stdio(false); cin.tie(0),cout.tie(0); int n; cin>>n; memset(arr,-1,sizeo原创 2022-02-20 22:49:33 · 199 阅读 · 0 评论 -
1112 Stucked Keyboard (20 分) (hash 模拟 细节 10/25
添加链接描述 先标记坏的键 ,然后把不是坏的键标记,然后从不是坏的键重新对坏的键进行标记 ,这样就做到了绝对得到坏的键 //如果这个键好的就不会是错的 //必须出现连续的键次数等于k的倍数(不能为0 //根据坏键的发现顺序输出一次set #include<bits/stdc++.h> using namespace std; map<char,bool>stuck; map<char,bool>no_stuck; map<char,bool>vis; int原创 2022-02-10 22:40:38 · 139 阅读 · 0 评论