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 ...
随机推荐
- spring error
<aop:config> <aop:pointcut id="allMethod" expression="execution(* a.j.shop.s ...
- NOJ1103-全排列
全排列 时间限制(普通/Java) : 1000 MS/ 3000 MS 运行内存限制 : 65536 KByte总提交 : 1148 测试通过 : 302 ...
- ANT编译build.xml
一,体验ant就像每个语言都有HelloWorld一样,一个最简单的应用能让人感受一下Ant1,首先你要知道你要干什么,我现在想做的事情是:编写一些程序编译它们把它打包成jar包把他们放在应该放置的地 ...
- angularjs+nodejs+mongodb三件套
说实话,自己对于web前段的认识并不是太深入,但是因为项目的需要,所以有的时候肯定会需要接触到web前段的知识点.说到web前端想必大家肯定会想到css+js+html,的确web前端的工作,从某总角 ...
- Douglas Crockford: entityify & deentityify
大神之字符与字符实体的相互转换方法 // & to & if (!String.prototype.entityify) { String.prototype.entityify = ...
- [转]AngularJS: 使用Scope时的6个陷阱
在使用AngularJS中的scope时,会有6个主要陷阱.如果你理解AngularJS背后的概念的话,这6个点其实非常的简单.但是在具体讲述这6个陷阱之前我们先要讲两个其它的概念. 概念1: 双向数 ...
- 65.OV7725图像倒置180度
采集的图像倒置180度,这跟寄存器的设置有关.寄存器0X32的bit[7]可以变换倒置方向.
- 42.JTAG接口使用注意
无论是客户反馈,还是自己亲身经历,USB-Blaster不能下载配置FPGA的情况时有出现.究其原因,大致有如下几条: 1. FPGA器件上的JTAG相关引脚出现故障: 2. USB-Blaster坏 ...
- DXP中原理图与PCB图元件互找
在原理图中找到元件,快捷键TS即可在PCB中找到元件,且为选中状态.
- Android -- Layout布局文件里的android:layout_height等属性为什么会不起作用?
有的时候,我们配置好的布局文件,在加载完成添加到我们的Activity中后发现,并没有安装我们设置的属性来布局,比如我们设置了android:layout_marginTop="100dip ...