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 前言: 老师要我们整理一份训练计划给下一届的学弟学妹们,整理出来了,费了不少笔墨,就也将它放到博客园上供大家参考. 菜 ...
随机推荐
- UploadHandleServlet
public class UploadHandleServlet extends HttpServlet { public void doGet(HttpServletRequest request, ...
- [LeetCode] Flip Game 翻转游戏之二
You are playing the following Flip Game with your friend: Given a string that contains only these tw ...
- 动态生成验证码———MVC版
上面有篇博客也是写的验证码,但那个是适用于asp.net网站的. 今天想在MVC中实现验证码功能,弄了好久,最后还是看博友文章解决的,感谢那位博友. 首先引入生成验证码帮助类. ValidateCod ...
- Python 日常积累
包管理 >from ... import ... 的用法和直接import的区别 直接使用import时,如果需要使用到导入模块内的属性和方法,必须使用模块名.属性和模块名.方法的方式进行调用 ...
- asp.net webservice返回json问题
使用jQuery $.ajax方法请求webservice 一.方法返回值为string,将json格式的字符串返回 设置contentType为"application/json;char ...
- 【BZOJ 2595】【WC 2008】游览计划
http://www.lydsy.com/JudgeOnline/problem.php?id=2595 斯坦纳树的例题诶...我怎么做了好长时间_(:з」∠)_ 首先这是一棵树. 状压表示状态,\( ...
- 【BZOJ 4582】【Usaco2016 Open】Diamond Collector
http://www.lydsy.com/JudgeOnline/problem.php?id=4582 排好序后用两个指针直接\(O(n)\)扫,貌似这个东西学名"two pointers ...
- 菜鸟git学习
基础知识: 安装github之后,所有的命令在git shell 中输入. E:\文档\GitHub [master +2 ~0 -0 !]> cd [ToDoList]E:\文档\GitHub ...
- 【USACO 3.3】Riding The Fences(欧拉路径)
题意: 给你每个fence连接的两个点的编号,输出编号序列的字典序最小的路径,满足每个fence必须走且最多走一次. 题解: 本题就是输出欧拉路径. 题目保证给出的图是一定存在欧拉路径,因此找到最小的 ...
- Leetcode 18. 4Sum
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = tar ...