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 前言: 老师要我们整理一份训练计划给下一届的学弟学妹们,整理出来了,费了不少笔墨,就也将它放到博客园上供大家参考. 菜 ...
随机推荐
- 011商城项目:图片服务器的安装---nginx
这个是电商的项目,不是传统项目,所以给图片单独架一台服务器. 我们看上图: 用户上传图片时上传到Tomcat1或者Tomcat2.然后Tomcat1和Tomcat2通过FTP服务把图片上传到图片服务器 ...
- [LeetCode] Palindrome Permutation II 回文全排列之二
Given a string s, return all the palindromic permutations (without duplicates) of it. Return an empt ...
- [LeetCode] Binary Tree Upside Down 二叉树的上下颠倒
Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left node that ...
- 琴弦文字 - wpf行为
效果图: 此效果的设计和实现思路均来自:上位者的怜悯 详情见原文:http://www.cnblogs.com/lianmin/p/5940637.html 我所做的,只是将原作者的设计和思路封装成了 ...
- poj题目
poj2965 poj1753:标准的BFS+位运算优化 poj1328:线段覆盖变种,把圆对应到线段上,贪心求解 poj2109:高精度开根,二分+高精度,注意要判断答案的位数,如果按照题目给的范围 ...
- [板子]ISAP
ISAP求最大流,敲了一发板子,无压行,教程略去.转载请随意. #include <cstdio> #include <cstring> #include <algori ...
- jetbrain系列IDE设置
1.代码提示默认ctrl+space(这是全角半角切换),改为alt+/,这与cyclic expand word冲突,直接删掉它就可以了 2.ctrl+M,进入presentation mode,与 ...
- xamarin.forms uwp app部署到手机移动设备进行测试,真机调试(device portal方式部署)
最近学习xamarin.刚好 手上有一个lumia 930.所以试一试把uwp app部署到手机上,并真机调试一把. 目前环境: 1.开发pc电脑是win10,版本1607.加入了insider,所以 ...
- vue.js之过渡效果-css
概述 vuejs的过渡效果可以让我们的页面元素在出现和消失时实现过渡.官方文档这样描述过渡效果的方式: 在 CSS 过渡和动画中自动应用 class 可以配合使用第三方 CSS 动画库,如 Anima ...
- vector定义初始化
头文件 #include<vector> using std::vector; vector<T> v1; vector<T> v2(v1); vector< ...