模拟

#include<iostream>
#include<algorithm>
#include<string.h>
#include<stdio.h>
#include<map>
using namespace std;
int vis[];
int n,flag;
long long a[];
char s[];
int chang(char x) {
if (x>=''&&x<='') {
int tmp=x-'';
return tmp;
}
if (x>='A'&&x<='C') return ;
if (x>='D'&&x<='F') return ;
if (x>='G'&&x<='I') return ;
if (x>='J'&&x<='L') return ;
if (x>='M'&&x<='O') return ;
if (x>='P'&&x<='S') return ;
if (x>='T'&&x<='V') return ;
if (x>='W'&&x<='Y') return ; //返回对应的数值
}
int main() {
scanf("%d",&n);
flag=;
for (int i=; i<=n; i++) {
scanf("%s",s); //输入字符串
long long tmp=;
for (int j=; s[j]; j++) //如果s[j]存在
if (s[j]=='-') continue; //跳过
else tmp=tmp*+chang(s[j]); //号码
vis[tmp]++; //标记出现过几次
a[i]=tmp; //记录号码
if (vis[tmp]>=) flag=; //如果大于两次 就记录 准备输出
}
if (!flag) {
printf("No duplicates.\n");
return ;
}
sort(a+,a++n); //出现的次数 默认升序
for (int i=; i<=n; i++)
if (vis[a[i]]>=) { //如果出现了两次 才输出
int kk=;
int ans=a[i];
for (int j=; j<=; j++) {
int tmp=ans/kk; //取第一位
ans%=kk; // 取第一位之后的数字
kk/=; //kk少一位0
printf("%d",tmp); //输出每一位
if (j==) printf("-"); //记得输出-
}
printf(" %d\n",vis[a[i]]); //输出次数
vis[a[i]]=; //再归零
}
return ;
}

Virtual Judge POJ 1002 487-3279的更多相关文章

  1. Virtual Judge POJ 3278 Catch That Cow

    #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #inclu ...

  2. Virtual Judge POJ 2251 Dungeon Master

    三维数组加宽搜 #include <stdlib.h> #include <string.h> #include <stdio.h> ; int c, k, h; ...

  3. Virtual Judge POJ 1328 Radar Installation

    贪心 #include<algorithm> #include<iostream> #include<cstdio> #include<cmath> u ...

  4. Virtual Judge使用指南

    https://cn.vjudge.net/ Virtual Judge并不是常规的Online Judge平台,他通过爬取其他OJ的题目,让我们可以直接在VJ上查找并提交各种OJ的题目,然后将我们的 ...

  5. 字符串专题:map POJ 1002

    第一次用到是在‘校内赛总结’扫地那道题里面,大同小异 map<string,int>str 可以专用做做字符串的匹配之类的处理 string donser; str [donser]++ ...

  6. POJ 1002 487-3279

    A - 487-3279 Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit ...

  7. virtual judge 本地部署方案

    这是一种将自己的电脑当作服务器来部署一个vj的方法,我也是参考前辈们的做法稍作了改动,如果在服务器上部署的话需要在细节上稍作改动: 一.什么是Virtual Judge? vj的工作原理什么?  vj ...

  8. [POJ 1002] 487-3279 C++解题报告

        487-3279 Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 228365   Accepted: 39826 D ...

  9. Poj 1002 487-3279(二叉搜索树)

    题目链接:http://poj.org/problem?id=1002 思路分析:先对输入字符进行处理,转换为标准形式:插入标准形式的电话号码到查找树中,若有相同号码计数器增加1,再中序遍历查找树. ...

随机推荐

  1. swiper快速切换插件(两个综合案例源码)

    swiper快速切换插件 swiper.js自己去官网下载哈.先来一个tab切换案例: demo.html <!doctype html> <html> <head> ...

  2. CentOS 编译安装 PyCrypto

    转载自:http://bugcharmer.blogspot.com/2012/07/building-pycrypto-on-amazon-ec2.html Step 1 - Install gcc ...

  3. Mac下各种编程环境的配置问题(python java)

    首先,去官网下载安装包.直接运行安装.安装完成后,启动器中会多两个应用程序IDLE和Python Launcher. 如果,你习惯在IDLE,直接运行即可. 但你在Terminal中运行python3 ...

  4. How Many Tables HDU - 1213

    #include<iostream> using namespace std; ; int p[N]; int find(int x) { if(p[x]!=x) p[x]=find(p[ ...

  5. Constructing Roads POJ - 2421 最小生成树板子题

    #include<iostream> #include<cstring> #include<algorithm> using namespace std; ; in ...

  6. pip淘宝镜像安装

    pip install virtualenvwrapper-win pip install -i https://pypi.tuna.tsinghua.edu.cn/simple virtualenv ...

  7. PAT - A1073

    1073 Scientific Notation (20point(s)) 小数点移动的边界条件 小数点左移 超过数据左边界 小数点右移 未超过数据右边界 超过数据右边界 +0.1E+2 --> ...

  8. C# LINQ学习笔记二:LINQ标准查询操作概述

    本笔记摘抄自:https://www.cnblogs.com/liqingwen/p/5801249.html,记录一下学习过程以备后续查用. “标准查询运算符”是组成语言集成查询 (LINQ) 模式 ...

  9. 使用nohup不产生log文件方法

    思想 无法阻止nohup产生日志可以将其定向到空文件实现 实现 $ nohup xxx >/dev/null 2>&1 &

  10. navicat异常 - 1130-host ... is not allowed to connect to this MySql server

    错误描述 用navicat连接数据库报错:1130-host ... is not allowed to connect to this MySql server如何处理 解决方案 1.连接服务器: ...