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 ...
随机推荐
- @Async java 异步方法
在spring 3中,@Async注解能让某个方法快速变为异步执行,马上来先DEMO上手下. 假如在网站的用户注册后,需要发送邮件,然后用户得到邮件确认后才能继续其他工作: 假设发送是一个很耗费时间的 ...
- ORA-00265: instance recovery required, cannot set ARCHIVELOG
OS: Oracle Linux Server release 5.7 DB: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - ...
- poj 2631 Roads in the North
题目连接 http://poj.org/problem?id=2631 Roads in the North Description Building and maintaining roads am ...
- .net 日期格式化
有时候我们要对时间进行转换,达到不同的显示效果 默认格式为:2005-6-6 14:33:34 如果要换成成200506,06-2005,2005-6-6或更多的该怎么办呢 我们要用到:DateTim ...
- Power Map 入门
Excel 的 Microsoft Power Map是三维 (3-D) 数据的可视化工具,允许您以新的方式看信息.电源映射允许您发现您可能看不到传统的二维 (2-d) 表和图中的见解. 使用Powe ...
- PHP闭包(Closure)初探
不知不觉发现PHP已经出到了5.5版本,而自己一直在用PHP5.2,让我看起来像深山出来的小伙子一样,又土又落后.在我习惯在javascript中使用闭包之后,忽然间对PHP的闭包打起了兴趣. 于是乎 ...
- [转]ubuntu 14.04 系统设置不见了
[转]ubuntu 14.04 系统设置不见了 http://blog.sina.com.cn/s/blog_6c9d65a10101i0i7.html 不知道删除什么了,系统设置不见了! 我在终端运 ...
- iOS 进阶 第二十二天(0603)
0603 block\运行时 block block的本质是一个指向结构体的指针. 运行时 要分析clang命令反编译出来的c++代码,就要把一些小括号删掉来分析.因为这些小括号一般都是类型强转. o ...
- JAVA标签的使用跳出循环
public static void main(String args[]) { int i=10,j=10; outer: while (i > 0) { inner: while (j &g ...
- Careercup - Microsoft面试题 - 5700293077499904
2014-05-12 00:02 题目链接 原题: For a given map (ie Bing map) given longitude/latitude/ how would you desi ...