poj 1002
来源:互联网 发布:linux排名 编辑:程序博客网 时间:2024/05/15 06:37
题目:http://poj.org/problemlist
#include<iostream>#include<algorithm>using namespace std;void change(char map[]){ for (int i = 0; i <= 9; i++) map[i + '0'] = i; map['A'] = map['B'] = map['C'] = 2; map['D'] = map['E'] = map['F'] = 3; map['G'] = map['H'] = map['I'] = 4; map['J'] = map['K'] = map['L'] = 5; map['M'] = map['N'] = map['O'] = 6; map['P'] = map['R'] = map['S'] = 7; map['T'] = map['U'] = map['V'] = 8; map['W'] = map['X'] = map['Y'] = 9; }int cmp(const void *a,const void *b){ return *(int*)a-*(int*)b;}int main(){ char map[300],str[300]; int *data; int n,i,j,temp,t; change(map); while(cin>>n) { data=new int[n]; for(i=0;i<n;i++) { cin>>str; temp=0; for(j=0;str[j]!='\0';j++) { if(str[j]=='-') continue; temp=temp*10+map[str[j]]; } data[i]=temp; } qsort(data,n,sizeof(data[0]),cmp); t=1; for(i=0;i<n;) { j=i; while(i<n&&data[++i]==data[j]); if(i-j>1) { printf("d-d %d\n",data[j]/10000,data[j]%10000,i-j); t=0; } } delete [] data; if(t) cout<<"No duplicates."<<endl; } return 0;}
0 0
- POJ 1002
- POJ 1002
- POJ 1002
- POJ 1002
- poj 1002
- POJ 1002
- POJ 1002
- poj 1002
- poj 1002
- POJ 1002
- POJ-1002
- poj 1002
- poj 1002
- poj 1002
- poj 1002
- poj-1002
- POJ 1002
- POJ 1002
- hdu 3677
- Irrationa problem
- Rock-paper-scissors 石头剪刀布
- cosos2dx中使用动画帧创建精灵的问题
- hdu 2203 亲和串
- poj 1002
- B - SaleBob 买电视啦!
- A - Reconnaissance 2 士兵 立正啦…
- MD5加密
- A - Translation字符串匹配问题
- poj 1005
- D - Gifts in a Hexagonal Box
- Count on Cantor 数表
- hdu 1003 递归(DP)