POJ1002
转化为七位数字
#include<iostream>
#include<map>
#include<cstring>
#include<cstdio>
using namespace std;
char buf[];
int num[]=
{
,,,
,,,
,,,
,,,
,,,
,,,,
,,,
,,
};
map<int ,int>s;
int main()
{
int n;
scanf("%d", &n);
bool flag=false;
for(int ii=;ii<n;ii++)
{
scanf("%s", &buf);
int c=; for(int i=;buf[i];i++)
{
if(isdigit(buf[i]))
c=c*+(buf[i]-'');
else if(isalpha(buf[i]))
c=c*+num[buf[i]-'A'];
}
s[c]++;
}
for(map<int,int>::iterator it=s.begin();it!=s.end();it++)
{
if(it->second>)
{
flag=true;
printf("%03d-%04d %d\n",it->first/,it->first%,it->second);
}
}
if(!flag)
puts("No duplicates.");
return ;
}
Close
POJ1002的更多相关文章
- poj1002 字典树+map+查询单词出现次数
487-3279 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 309235 Accepted: 55223 Descr ...
- 487-3279[POJ1002]
487-3279 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 284182 Accepted: 51001 Descr ...
- POJ1002 487-3279
Description 企业喜欢用容易被记住的电话号码.让电话号码容易被记住的一个办法是将它写成一个容易记住的单词或者短语.例如,你需要给滑铁卢大学打电话时,可以拨打TUT-GLOP.有时,只将电话号 ...
- POJ-1002 解题报告
1.题目描述 http://poj.org/problem?id=1002 2.解题过程 按部就班来解题的话,这个题目很容易写出来,这是我的第一个版本的代码,思路是读入一行电话字符串,均转化为整型 ...
- C# ACM poj1002
排序 public static void acm1002(string[] azx) { string[] a = new string[azx.Length]; ; i < azx.Leng ...
- poj1002总结
1.之前一直是runtime error,没有找出具体原因,把冒牌排序改成了合并排序,当输入是100000行时,从大约10s变到1s内 2.感觉是atoi指针导致的,当判断atoi的入参不为NULL时 ...
- poj1002 大数的 n的m次
import java.math.BigDecimal; import java.util.Scanner; public class Main { public static void main(S ...
- 字典树应用 - poj1002
字典树应用 - poj 1002 Description Businesses like to have memorable telephone numbers. One way to make a ...
- ACM训练计划建议(写给本校acmer,欢迎围观和指正)
ACM训练计划建议 From:freecode# Date:2015/5/20 前言: 老师要我们整理一份训练计划给下一届的学弟学妹们,整理出来了,费了不少笔墨,就也将它放到博客园上供大家参考. 菜 ...
随机推荐
- Hadoop 2.x
Hadoop 2.x 生态系统及技术架构图 一.负责收集数据的工具:Sqoop(关系型数据导入Hadoop)Flume(日志数据导入Hadoop,支持数据源广泛)Kafka(支持数据源有限,但吞吐大) ...
- Softreference | WeakReference
转自:http://blog.csdn.net/kavendb/article/details/5935577 本文介绍对象的强.软.弱和虚引用的概念.应用及其在UML中的表示. 1.对象的强.软.弱 ...
- 分享“12306 P2P平台”创业Idea
结合云平台抢票,社区,P2P等性质,实施供求抢票平台,能有效提高和整合抢票市场,抢票优势以杜绝黄牛,给散户提供更有利的抢票途径.本在11月计划实施,后去搞比特币,故分享摘要集思广益. 背景 ...
- ElasticSearch第四步-查询详解
ElasticSearch系列学习 ElasticSearch第一步-环境配置 ElasticSearch第二步-CRUD之Sense ElasticSearch第三步-中文分词 ElasticSea ...
- 昆仑游戏[JS加密修改]
昆仑游戏:http://www.kunlun.com/index.html JS加密修改 BigTools=window.BigTools;//重点 RSAKeyPair=window.RSAKeyP ...
- VLC 资料整理
libvlc_media_t的创建 创建libvlc_media_t有两种方法:libvlc_media_new_path()和libvlc_media_new_location().简单描述一下这两 ...
- AC自动机 HDU 2896
n个字串 m个母串 字串在母串中出现几次 #include<stdio.h> #include<algorithm> #include<string.h> #inc ...
- java的字符串截取
import java.util.Date; import java.text.SimpleDateFormat; Date now = new Date(); def portcodes = new ...
- c语言之I/O函数
c语言中常用的I/O函数 最常用的字符串的标准I/O函数有getchar().putchar().gets().puts().scanf().printf().fputs().fgets().getc ...
- Android——WebView
WebView用途 通过Intent调用系统浏览器: 引言: Uri uri = Uri.parse(url);//url为你要链接的地址 Intent intent = new Intent(Int ...