Vontroy
首頁(yè)
新隨筆
聯(lián)系
聚合
管理
POJ 1002 487-3279 字符串處理
#include
<
iostream
>
#include
<
string
>
#include
<
algorithm
>
#include
<
cstdio
>
const
int
maxn
=
20000
;
const
int
MAXN
=
100000
+
10
;
using
std ::
string
;
using
std :: cout;
using
std :: endl;
int
main()
{
string
ans[MAXN];
char
tel[maxn];
char
store[maxn];
int
n;
bool
ok;
while
(
~
scanf(
"
%d
"
,
&
n))
{
ok
=
false
;
int
count
=
0
;
while
(n
--
)
{
scanf(
"
%s
"
,tel);
int
j;
for
(
int
i
=
0
,j
=
0
; tel[i]
!=
'
\0
'
; i
++
)
{
if
(tel[i]
-
'
0
'
>=
0
&&
tel[i]
-
'
0
'
<=
9
)
store[j
++
]
=
tel[i];
else
if
(tel[i]
!=
'
-
'
&&
j
!=
3
)
{
//
ans[count]+='2';
if
(tel[i]
==
'
A
'
||
tel[i]
==
'
B
'
||
tel[i]
==
'
C
'
)
store[j
++
]
=
'
2
'
;
else
if
(tel[i]
==
'
D
'
||
tel[i]
==
'
E
'
||
tel[i]
==
'
F
'
)
store[j
++
]
=
'
3
'
;
else
if
(tel[i]
==
'
G
'
||
tel[i]
==
'
H
'
||
tel[i]
==
'
I
'
)
store[j
++
]
=
'
4
'
;
else
if
(tel[i]
==
'
J
'
||
tel[i]
==
'
K
'
||
tel[i]
==
'
L
'
)
store[j
++
]
=
'
5
'
;
else
if
(tel[i]
==
'
M
'
||
tel[i]
==
'
N
'
||
tel[i]
==
'
O
'
)
store[j
++
]
=
'
6
'
;
else
if
(tel[i]
==
'
P
'
||
tel[i]
==
'
R
'
||
tel[i]
==
'
S
'
)
store[j
++
]
=
'
7
'
;
else
if
(tel[i]
==
'
T
'
||
tel[i]
==
'
U
'
||
tel[i]
==
'
V
'
)
store[j
++
]
=
'
8
'
;
else
if
(tel[i]
==
'
W
'
||
tel[i]
==
'
X
'
||
tel[i]
==
'
Y
'
)
store[j
++
]
=
'
9
'
;
}
if
( j
==
3
) store[j
++
]
=
'
-
'
;
}
ans[count
++
]
=
store;
}
std :: sort(ans,ans
+
count);
int
ans_count;
for
(
int
i
=
0
; i
<
count; i
++
)
{
ans_count
=
1
;
for
(
int
j
=
i
+
1
; j
<
count; j
++
)
{
if
(ans[j]
==
ans[i]) ans_count
++
;
else
break
;
}
if
(ans_count
>
1
)
{
ok
=
true
;
cout
<<
ans[i]
<<
"
"
<<
ans_count
<<
endl;
i
+=
(ans_count
-
1
);
}
}
if
(
!
ok) cout
<<
"
No duplicates.
"
<<
endl;
//
for(int i = 0; i <count; i++)
//
std :: cout << ans[i] << std :: endl;
}
return
0
;
}
posted on 2010-10-02 19:21
Vontroy
閱讀(306)
評(píng)論(0)
編輯
收藏
引用
所屬分類:
字符串
、
POJ
只有注冊(cè)用戶
登錄
后才能發(fā)表評(píng)論。
【推薦】100%開(kāi)源!大型工業(yè)跨平臺(tái)軟件C++源碼提供,建模,組態(tài)!
相關(guān)文章:
字典樹(shù)(Trie樹(shù))
HDU 2734 Quicksum 簡(jiǎn)單字符串處理
POJ 1007 DNA Sorting 字符串處理|穩(wěn)定排序
POJ 1002 487-3279 字符串處理
網(wǎng)站導(dǎo)航:
博客園
IT新聞
BlogJava
博問(wèn)
Chat2DB
管理
留言簿
(1)
給我留言
查看公開(kāi)留言
查看私人留言
隨筆分類
(55)
ACM Experience(1)
C++(1)
HDU(9)
Linux(2)
POJ(14)
并查集(2)
大數(shù)/高精度(2)
動(dòng)態(tài)規(guī)劃(2)
計(jì)算幾何(2)
數(shù)論(5)
數(shù)學(xué)題(4)
搜索(2)
貪心(1)
線段樹(shù)|樹(shù)狀數(shù)組(3)
字符串(4)
組合數(shù)學(xué)(1)
最新隨筆
1.?POJ 2488 A Knight's Journey (DFS)
2.?字典樹(shù)(Trie樹(shù))
3.?POJ 2653 Pick-up sticks 判斷線段相交
4.?POJ 1269 Intersecting Lines 判斷直線相交并求交點(diǎn)
5.?HDU 2734 Quicksum 簡(jiǎn)單字符串處理
6.?HDU 3661 Assignments-2010 Harbin Regional
7.?HDU 1097 A hard puzzle
8.?POJ 1007 DNA Sorting 字符串處理|穩(wěn)定排序
9.?POJ 1006 Biorhythms 中國(guó)剩余定理
10.?POJ 1005 I Think I Need a Houseboat
11.?POJ 1004 Financial Management
12.?POJ 1002 487-3279 字符串處理
13.?HDU 1056 HangOver
14.?POJ 1458 Common Subsequence
15.?HDU 1788 Chinese remainder theorem again
16.?數(shù)論及數(shù)學(xué)常用知識(shí)代碼
17.?組合數(shù)學(xué)常用公式及算法
18.?HDU 1018 Big Number
19.?求兩個(gè)或N個(gè)數(shù)的最大公約數(shù)(gcd)和最小公倍數(shù)(lcm)的較優(yōu)算法
20.?HDU 1316 How Many Fibs?
21.?POJ 2488 A Knight's Journey ----- DFS
22.?POJ 3468 A Simple Problem with Integers
23.?POJ 3264 Balanced Lineup
24.?POJ 1611 The Suspects
25.?HDU 1198 Farm Irrigation
26.?HDU 1010 Tempter of the Bone
27.?POJ 2528 Mayor's posters
28.?ACM初學(xué)經(jīng)典題(字符串處理+對(duì)字符串的排序與檢索)
29.?POJ 1001 Exponentiation
30.?ACM中Java的應(yīng)用
搜索
最新評(píng)論
1.?re: 求兩個(gè)或N個(gè)數(shù)的最大公約數(shù)(gcd)和最小公倍數(shù)(lcm)的較優(yōu)算法[未登錄](méi)
初學(xué)ACM....算法謝啦~雖然暫時(shí)難以理解....研究下
--路人甲
閱讀排行榜
1.?C++ map 映照容器(6180)
2.?ACM中Java的應(yīng)用(4373)
3.?求兩個(gè)或N個(gè)數(shù)的最大公約數(shù)(gcd)和最小公倍數(shù)(lcm)的較優(yōu)算法(3551)
4.?組合數(shù)學(xué)常用公式及算法(2026)
5.?ACM初學(xué)經(jīng)典題(字符串處理+對(duì)字符串的排序與檢索)(1425)
Powered by:
博客園
模板提供:
滬江博客
Copyright ©2025 Vontroy
欧美日韩精品久久免费
|
精品久久777
|
麻豆亚洲AV永久无码精品久久
|
国产Av激情久久无码天堂
|
久久这里只有精品首页
|
思思久久好好热精品国产
|
久久精品九九亚洲精品
|
女同久久
|
久久国产乱子精品免费女
|
久久久99精品成人片中文字幕
|
久久国产AVJUST麻豆
|
国产精品欧美久久久天天影视
|
人妻精品久久久久中文字幕
|
www久久久天天com
|
国产美女亚洲精品久久久综合
|
99久久99久久精品国产
|
久久精品一本到99热免费
|
久久久久久久综合狠狠综合
|
国产成人无码精品久久久久免费
|
亚洲色大成网站WWW久久九九
|
久久精品国产精品亚洲下载
|
av午夜福利一片免费看久久
|
国色天香久久久久久久小说
|
亚洲精品乱码久久久久久蜜桃
|
91精品无码久久久久久五月天
|
AV无码久久久久不卡网站下载
|
麻豆精品久久久久久久99蜜桃
|
热久久国产欧美一区二区精品
|
国产成人无码精品久久久免费
|
精品久久一区二区
|
99久久人妻无码精品系列蜜桃
|
久久天天躁狠狠躁夜夜不卡
|
久久受www免费人成_看片中文
|
久久人人爽人爽人人爽av
|
久久午夜综合久久
|
久久久综合香蕉尹人综合网
|
久久伊人亚洲AV无码网站
|
久久无码人妻精品一区二区三区
|
久久最新免费视频
|
久久亚洲色一区二区三区
|
久久久久国产一级毛片高清板
|