PAT甲级1054 The Dominant Color:[C++题解]哈希表、水题
生活随笔
收集整理的這篇文章主要介紹了
PAT甲级1054 The Dominant Color:[C++题解]哈希表、水题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
文章目錄
- 題目分析
- 題目鏈接
題目分析
來源:acwing
AC代碼
#include<bits/stdc++.h> using namespace std; const int N = 610,M = 810;int main(){int n, m;unordered_map<int,int> mp;cin >> m >> n;for(int i =0; i<n*m; i++){int x;cin >> x;mp[x]++;if(mp[x]> m*n/2){cout<<x;break;}}}題目鏈接
PAT甲級1054 The Dominant Color
https://www.acwing.com/problem/content/1542/
總結
以上是生活随笔為你收集整理的PAT甲级1054 The Dominant Color:[C++题解]哈希表、水题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: PAT甲级1047 Student Li
- 下一篇: PAT甲级1056 Mice and R