hdu 1004 let the balloon rise
2016-01-24 00:21
363 查看
#include<cstdio> #include<iostream> #include<cstring> using namespace std; int main() { char str[1100][20];//开个二维数组来存储 int i,j; int n; int pos;//记录颜色出现最多次的气球颜色在数组中的小标 int mmax,cnt; while(cin>>n,n!=0) { for(i=1;i<=n;i++) { str[i][0]='1'; } for(i=1;i<=n;i++) { cin>>str[i]; } mmax=0; for(i=1;i<=n;i++) { cnt=1; for(j=i+1;j<=n;j++) { if(str[j][0]!='1')//统计的时候用这个来标记统计过的气球 { if(strcmp(str[i],str[j])==0) { cnt++; str[j][0]='1'; } } } if(cnt>mmax) { pos=i; mmax=cnt; } } cout<<str[pos]<<endl; } return 0; }
相关文章推荐
- Ubuntu15.04YouCompleteMe插件安装
- 谨献给为了知识执着的嵌入式初学者
- MySQL优化技巧之二(sql优化总结)
- mysql字符集和校对规则(Mysql校对集)
- visual studio开发工具的C#主流控件属性一览表
- 为RecyclerView设置emptyView
- 设计自己的高并发架构
- Oracle B-tree、位图、全文索引三大索引性能比较及优缺点汇总
- 索引——位图索引
- HDU 1678 Shopaholic(贪心)
- 将Vim改造为强大的IDE
- Xshell配置ssh免密码登录-密钥公钥(Public key)与私钥(Private Key)登录
- ArcGIS 地图切图原理解析
- 设计模式的六大原则
- MySQL 主键与索引的联系与区别分析
- MySQL的表分区
- 验证码识别,发票编号识别
- 蓝桥杯:基础练习 十六进制转十进制
- 如何招聘产品经理?
- Xib和购物车UI界面的完善