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 ...
随机推荐
- C语言如何 实现 下雪效果
题外话 前言 1.本文主要围绕 如何 在 控制台上 下起 一场 只有自己能看见的雪 2.是个简易跨平台的,主要是C语言 3.动画 采用 1s 40帧, 雪花具有 x轴速度和y轴速度 4.比较简单,可 ...
- 使用Linux调用资源库中的Job报错-ERROR: No repository provided, can't load job.
使用kettle调用资源库中的作业或者是转换,需要注意一下两个问题: 问题一:(-rep后不需要IP)标准shell代码如下 #!/bin/bash export JAVA_HOME=/usr/lib ...
- css权重及优先级问题
css权重及优先级问题 几个值的对比 初始值 指定值 计算值 应用值 CSS属性的 指定值 (specified value)会通过下面3种途径取得: 在当前文档的样式表中给这个属性赋的值,会被优先使 ...
- 深入浅出const
§通常,如果一个对象通过引用方式传到函数f中,而函数f又不会通过修改对象的数据成员的值改变该对象的状态,那么,我们最好将f的参数标记为const,这样可以预防对参数的误写,同时有些编译器还可对这种情况 ...
- 部分手机不能连PC adb
http://www.th7.cn/Program/java/201407/232139.shtml 1. 命令行中执行 android update adb [这一步的目的是产生下面第二步的路径和文 ...
- eclipse创建android项目失败的问题 [ android support library ]
有根筋搭错了,想起来android应用开发???? 放下两年的手机应用开发,昨天有更新了android SDK, 重新搭建开发环境. 这两年android 变化真TM的大............... ...
- python 实现求和、计数、最大最小值、平均值、中位数、标准偏差、百分比。
import sys class Stats: def __init__(self, sequence): # sequence of numbers we will process # conver ...
- Objective-C 一些概念
Automatic Reference Counting (ARC)
- 条款3:尽可能地使用const
如下为const修饰的几种类型: char name[] = "benxintuzi"; char* p1 = name; // non-const ...
- My97DatePicker控制开始时间和结束时间区间
开始时间: <input type="text" placeholder=" -请选择- " id="kssj" name=" ...