poj 1002 模拟
来源:互联网 发布:php的配置文件在哪里 编辑:程序博客网 时间:2024/06/13 23:20
题目:
http://poj.org/problem?id=1002
这题……
好吧……
额……
WA了三四十遍……
总结:
1.看清楚题意……;
2.注意输出有无句号,叹号等符号……;
#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;const int MAXN=11000001;int n,tot,num,h;char s[1001];int a[200001],cnt[MAXN];int biao[]={2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,0,7,7,8,8,8,9,9,9,0};bool flag=0;void solve(){ cin>>n; for(int i=1;i<=n;i++) { num=0,h=1; scanf("%s",s+1); for(int j=1;j<=strlen(s+1);j++) { if(s[j]=='-') continue; if(s[j]>='0' && s[j]<='9') num=num*10+s[j]-'0'; else if(s[j]<'Z' && s[j]>='A' && s[j]!='Q') num=num*10+biao[s[j]-'A']; if(s[j]=='Z' || s[j]=='Q') h=0; } if(h) { if(!cnt[num]) a[++tot]=num; cnt[num]++; } } sort(a+1,a+tot+1); for(int i=1;i<=tot;i++) { if(cnt[a[i]]>=2) printf("%03d-%04d %d\n",a[i]/10000,a[i]%10000,cnt[a[i]]),flag=1;//可能有前导0; } if(!flag) printf("No duplicates.\n");//有句号!!!!! return; }int main(){ solve(); return 0;}
阅读全文
0 0
- POJ 1002 (字符串 && 模拟)
- poj 1002 模拟
- Poj 1002水题模拟
- poj 1002 487-3279(基础模拟题)
- POJ-1002 487-3279 模拟问题
- POJ 1002 487-3279 (模拟 水题)
- POJ 1017 模拟啊模拟
- POJ 1565 水 模拟
- Poj 模拟题
- POJ 1068 括号模拟
- POJ 2453 简单模拟
- POJ 2833 简单模拟
- POJ 1016 模拟题
- 模拟退火 poj 1379
- poj 1379 模拟退火
- poj 3285 模拟退火,
- POJ 1068 Parencodings 模拟
- POJ 3295 Tautology 模拟
- CSS的单列布局与二&三列布局
- MongoDB:21-MongoDB-自增Id
- Wiki中文语料处理-python
- hadoop3.0高可用HA大数据平台架构软件和部署方案(二)
- #Thinking in Java阅读笔记# 第七章 复用类
- poj 1002 模拟
- ServiceComb中的数据最终一致性方案
- TensorFlow:Chap5笔记总结(MNIST数字识别)
- Delphi出现“borland license information was found,but it is not valid for delphi”的错误,无法运行的解决方法
- 宜优速学习网址--phpstudy配置--我的码云账号--apizza接口文档
- 位运算将十进制转化二进制
- 百度地图定位集成及问题汇总No implementation found for int com.baidu.platform.comjni.tools.JNITools.initClass
- 人脸检测--SSH: Single Stage Headless Face Detector
- 分享 AFNetwork Post方式请求不通的问题。