
哈希
幽殇默
他时若遂凌云志,敢笑黄巢不丈夫。
展开
-
496. 下一个更大元素 I【哈希表】
https://leetcode-cn.com/problems/next-greater-element-i/ class Solution { public: vector<int> nextGreaterElement(vector<int>& nums1, vector<int>& nums2) { unordered_map<int,int>mp; int n=nums1.size(); .原创 2021-10-26 10:26:24 · 92 阅读 · 0 评论 -
C. Registration system【1300 / 哈希】
https://codeforces.com/problemset/problem/4/C #include<bits/stdc++.h> using namespace std; unordered_map<string,int>mp; int main(void) { int n; cin>>n; for(int i=0;i<n;i++) { string s; cin>>s; if(mp.count(s)==0) cout<&.原创 2021-10-24 15:28:41 · 2006 阅读 · 0 评论 -
A. Towers【1000 / 哈希表】
https://codeforces.com/problemset/problem/37/ 就是统计一下哪个数字出现的次数最多,再输出哈希表的大小。 #include<bits/stdc++.h> using namespace std; const int N=1e4+10; int a[N],ans; map<int,int>mp; int main(void) { int n; cin>>n; for(int i=0;i<n;i++) cin>&g.原创 2021-10-12 08:57:41 · 91 阅读 · 0 评论 -
A. Free Cash【1000 / 哈希表】
https://codeforces.com/problemset/problem/237/A 就是统计同一时刻最多有多少个人。 #include<bits/stdc++.h> using namespace std; map<string,int>mp; int main(void) { int t; cin>>t; int ans=0; while(t--) { string a,b; cin>>a>>b; string s.原创 2021-10-02 09:17:54 · 112 阅读 · 0 评论 -
【1004】 Let the Balloon Rise【水题】
http://acm.hdu.edu.cn/showproblem.php?pid=1004 用G++ 提交 #include<cstdio> #include<iostream> #include<map> using namespace std; int main(void) { int n; while(cin>>n,n) { string s; map<string,int>mp; for(int i=0;i<n;.原创 2021-05-05 22:35:27 · 81 阅读 · 0 评论