hdu 1800 Flying to the Mars(简单模拟,string,字符串)
又来了string的基本用法
//less than 30 digits
//等级长度甚至是超过了int64,所以要用字符串来模拟,然后注意去掉前导零
//最多重复的个数就是答案
//关于string的修改增加的用法 #include <cstdio>
#include<iostream>
#include <cstring>
#include <algorithm>
#include<string>
using namespace std; int main()
{
int n;
char s[];
while(scanf("%d",&n)!=EOF)
{
string ss[];
for(int i=;i<n;i++)
{
scanf("%s",s);
int l=strlen(s);
int id=;
for(int j=;j<l;j++)
{
if(s[j]!='')break;
id++;
}
for(int j=id;j<l;j++)
{
ss[i]+=s[j];
}
}
sort(ss,ss+n);
int ans=;
int maxx=;
for(int i=;i<n;i++)
{
if(ss[i]==ss[i-])ans++,maxx=max(maxx,ans);
else
ans=;
}
printf("%d\n",maxx);
}
return ;
}
hdu 1800 Flying to the Mars(简单模拟,string,字符串)的更多相关文章
- hdu 1800 Flying to the Mars
Flying to the Mars 题意:找出题给的最少的递增序列(严格递增)的个数,其中序列中每个数字不多于30位:序列长度不长于3000: input: 4 (n) 10 20 30 04 ou ...
- HDU 1800——Flying to the Mars——————【字符串哈希】
Flying to the Mars Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Other ...
- --hdu 1800 Flying to the Mars(贪心)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1800 Ac code: #include<stdio.h> #include<std ...
- HDU - 1800 Flying to the Mars 【贪心】
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1800 题意 给出N个人的 level 然后 高的level 的 人 是可以携带 比他低level 的人 ...
- HDU 1800 Flying to the Mars 字典树,STL中的map ,哈希树
http://acm.hdu.edu.cn/showproblem.php?pid=1800 字典树 #include<iostream> #include<string.h> ...
- HDU 1800 Flying to the Mars Trie或者hash
http://acm.hdu.edu.cn/showproblem.php?pid=1800 题目大意: 又是废话连篇 给你一些由数字组成的字符串,判断去掉前导0后那个字符串出现频率最高. 一开始敲h ...
- 杭电 1800 Flying to the Mars(贪心)
http://acm.hdu.edu.cn/showproblem.php?pid=1800 Flying to the Mars Time Limit: 5000/1000 MS (Java/Oth ...
- HDOJ.1800 Flying to the Mars(贪心+map)
Flying to the Mars 点我挑战题目 题意分析 有n个人,每个人都有一定的等级,高等级的人可以教低等级的人骑扫帚,并且他们可以共用一个扫帚,问至少需要几个扫帚. 这道题与最少拦截系统有异 ...
- 【HDOJ】1800 Flying to the Mars
1. 题目描述挺简单的一道题,给定$n$个大整数,求出现最多的次数. 2. 基本思路这题是可以使用哈希做,ELFHash等哈希都可以过. 3. 代码 /* 1800 */ #include <i ...
随机推荐
- [转]从普通DLL中导出C++类 – dllexport和dllimport的使用方法(中英对照、附注解)
这几天写几个小程序练手,在准备将一个类导出时,发现还真不知道如果不用MFC的扩展DLL,是怎么导出的.但我知道dllexport可以导出函数和变量,而且MFC扩展DLL就算是使用了MFC的功能,但 ...
- 获取 UIWebView中用户所点击的图片URL
在使用 UIWebView 的时候 (通常是阅读类的 App),会有点击图片放大的需求,那么可以通过设置 UIWebViewDelegate 来过滤请求,取出图片的 URL 这个方法的前提是 img ...
- 【译】理解与分析ios应用的崩溃报告
源网址: http://developer.apple.com/library/ios/#technotes/tn2151/_index.html 当一个应用程序崩溃时,创建一份“崩溃报告”对于理解崩 ...
- 第2章 变量和基本类型 附3---底层const和顶层const
和英文版的对: As we’ve seen, a pointer is an object that can point to a different object. As a result,we c ...
- iOS 进阶 第十六天(0419)
0419 任何view默认不支持多点触控,有一个属性设置Multiple Touch,设置为Yes即可支持多点触控 触摸移动一个view,让view也跟着动代码 关于触摸的一些解释: 注意:touch ...
- opencv颜色识别代码分享
android 平台 opencv 实现颜色识别代码:http://www.eyesourcecode.com/thread-40682-1-1.htmlopencv的颜色识别简单实现的代码:http ...
- SQL Server Reporting Services – Insufficient Rights Error
http://www.sql-server-performance.com/2011/security-ssrs-reporting-error/ SQL Server Reporting Servi ...
- 设计模式 -- 单例模式(Java&&PHP)
所谓单例模式,简单来说,就是在整个应用中保证只有一个类的实例存在.就像是Java Web中的application,也就是提供了一个全局变量,用处相当广泛,比如保存全局数据,实现全局性的操作等. 能够 ...
- 基于word制作网站webhelp
处理问题描述:现在我有个javaweb项目,需要在portal上面点击help即可打开: 当前搜索百度(谷歌不能用了),没有找到更好的解决方案,自己想了个比较简单实用的方法,仅供参考: 设计原理:利用 ...
- xcode 运行报错 Command /usr/bin/codesign failed with exit code 1
因为更换了证书,导致在运行时报错 Command /usr/bin/codesign failed with exit code 1,查看了网上各种方法,最后发现以下两个值没有同步更新