HDU 1004

第一次写map   纪念

 1 #include <map>
 2 #include <cstdio>
 3 #include <iostream>
 4 #include <string>
 5 #include <cstring>
 6 #include <string.h>
 7 using namespace std;
 8 map<string,int> a;
 9 int main(){
10     int t,max1;
11     string s,k;
12     while(scanf("%d",&t)!=EOF){
13             if(t==0)break;
14         max1=0;
15         while(t--){
16             cin>>s;
17             a[s]++;
18             if(a[s]>max1){max1=a[s];k=s;}
19         }
20         cout<<k<<endl;
21     }
22     return 0;
23 }

HDU 1004,布布扣,bubuko.com

时间: 2024-10-08 09:29:56

HDU 1004的相关文章

HDU 1004 Let the Balloon Rise【STL&lt;map&gt;】

Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 123800    Accepted Submission(s): 48826 Problem Description Contest time again! How excited it is to see balloons floating ar

HDU 1004(map的使用)

传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1004 Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 143275    Accepted Submission(s): 56670 Problem Description Contest time

hdu 1004 Let the Balloon Rise

Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 80469    Accepted Submission(s): 30293 Problem Description Contest time again! How excited it is to see balloons floating aro

HDU 1004 Let the Balloon Rise map

Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 104108    Accepted Submission(s): 40046 Problem Description Contest time again! How excited it is to see balloons floating ar

Let the Balloon Rise HDU 1004

Let the Balloon Rise Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 150   Accepted Submission(s) : 63 Problem Description Contest time again! How excited it is to see balloons floating around. B

水题/hdu 1004 Let the Balloon Rise

题意 给出n个字符串,输出出现次数最多的那个 分析 存下字符串后排序,再统计,输出 Accepted Code 1 /* 2 PROBLEM:hdu1004 3 AUTHER:Nicole Lam 4 MEMO:水题 5 */ 6 7 #include<iostream> 8 #include<cstring> 9 #include<string> 10 #include<algorithm> 11 using namespace std; 12 13 in

hdu 1004 map和非map写法

Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 116867 Accepted Submission(s): 45783 Problem Description Contest time again! How excited it is to see balloons floating around.

HDU 1004 Let the Balloon Rise (map使用)

分析:题意简单,就用map的知识即可 #include <stdio.h> #include <iostream> #include <string.h> #include <map> using namespace std; int main() { int i,a,b,k; int N; char num[10]; while (~scanf("%d",&N)) { map<string,int> mp; whil

HDU 1004(AC代码)

1 #include <stdio.h> 2 #include <string.h> 3 char a[1000][16]; 4 int b[1000]={0}; 5 int main() 6 { 7 int n,i,j,k,max,loc; 8 while(scanf("%d",&n)!=EOF&&n!=0){ 9 max=-1; 10 k=0; 11 loc=0; 12 for(i=0;i<n;i++){ 13 scanf(&q