URAL 1510. Order(map 数学啊)
2015-03-28 10:46
253 查看
题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1510
题意:
Output the most common value.
看最后一句就知道拉!
注意:G++超时,用C++交!
代码如下:
Time limit: 1.0 second |
input | output |
---|---|
5 3 3 2 2 3 | 3 |
Output the most common value.
看最后一句就知道拉!
注意:G++超时,用C++交!
代码如下:
#include <cstdio> #include <cmath> #include <cstring> #include <string> #include <map> #include <iostream> #include <algorithm> using namespace std; map<int,int >a; int main() { int n; while(~scanf("%d",&n)) { int tt; int maxx = 0; int ans = -1; for(int i = 0; i < n; i++) { scanf("%d",&tt); a[tt]++; if(a[tt] > maxx) { ans = tt; maxx = a[tt]; } } printf("%d\n",ans); } return 0; }
相关文章推荐
- URAL 1502. Domino Dots(数学)
- Ural1209(数学推导)
- URAL 2001 Mathematicians and Berries (小学数学题)
- URAL 1981. Parallel and Perpendicular(数学 )
- URAL 1820. Ural Steaks(数学啊 )
- URAL 1551. Sumo Tournament(数学啊 )
- URAL 1080 Map Coloring(染色)
- URAL 1613. For Fans of Statistics(STL 数学啊 )
- URAL 1874. Football Goal(数学 浮点数三分)
- URAL 1515 Cashmaster 数学题
- URAL 1068. Sum (小学数学题)
- URAL 1718 . Rejudge(数学啊 )
- URAL 1762 Search for a Hiding-Place(数学·模拟)
- ural 1080 Map Coloring DFS染色
- URAL 2070 Interesting Numbers(数学)
- URAL —— 1255 & HDU 5100——Chessboard ——————【数学规律】
- 【数学题】【网络流】风扇 blower ural1765
- URAL 1984. Dummy Guy(数学啊)
- URAL 1157. Young Tiler (数学啊 )
- URAL 1731. Dill(数学啊 )