zoj 3406 Another Very Easy Task
2013-03-19 21:46
411 查看
Another Very Easy TaskTime Limit: 2 Seconds Memory Limit: 65536 KB
This task is so easy that the description is omitted.
这道水题,纠结好久,唉,真是思维不严谨啊,以后输出字符类的输出的题目一定要输出到文件,不然哪里错了都看不出来,水题还这么卡,看来自己需要练练手速,还有做题的准确度。
This task is so easy that the description is omitted.
Sample Input
A numeronym is a number-based word. Most commonly, a numeronym is a word where a number is used to form an abbreviation (albeit not an acronym or an initialism). Pronouncing the letters and numbers may sound similar to the full word: "K9" for "canine" (phonetically: "kay" + "nine"). A similar example in French is "K7" for "cassette" (phonetically: "ka" + "sept"). Alternatively, the letters between the first and last are replaced by a number representing the number of letters omitted, such as "i18n" for "internationalization". Sometimes the last letter will also be counted and omitted. According to Tex Texin, the first numeronym of this kind was "S12n", the electronic mail account name given to DEC employee Jan Scherpenhuizen by a system administrator because his surname was too long to be an account name. Colleagues who found Jan's name unpronounceable often referred to him verbally as "S12n". The use of such numeronyms became part of DEC corporate culture.
Sample Output
A n7m is a n4r-b3d w2d. M2t c6y, a n7m is a w2d w3e a n4r is u2d to f2m an a10n (a4t n1t an a5m or an i8m). P9g t1e l5s a1d n5s m1y s3d s5r to t1e f2l w2d: "K9" f1r "c4e" (p10y: "k1y" + "n2e"). A s5r e5e in F4h is "K7" f1r "c6e" (p10y: "ka" + "s2t"). A11y, t1e l5s b5n t1e f3t a1d l2t a1e r6d by a n4r r10g t1e n4r of l5s o5d, s2h as "i18n" f1r "i18n". S7s t1e l2t l4r w2l a2o be c5d a1d o5d. A7g to T1x T3n, t1e f3t n7m of t2s k2d w1s "S12n", t1e e8c m2l a5t n2e g3n to D1C e6e J1n S12n by a s4m a11r b5e h1s s5e w1s t1o l2g to be an a5t n2e. C8s w1o f3d J1n's n2e u13e o3n r6d to h1m v6y as "S12n". T1e u1e of s2h n8s b4e p2t of D1C c7e c5e.
#include <iostream> #include <cctype> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> using namespace std; char a[100000]; int main(void){ #ifndef ONLINE_JUDGE freopen("1.in", "r", stdin); freopen("1.out", "w", stdout); #endif while (gets(a)){ int len = strlen(a); bool flag = false; int cnt = 0; for (int i = 0; i < len; ++i){ cnt = 0; flag = false; while (isalpha(a[i])){ if (!flag){ flag = true; printf("%c", a[i]); } else cnt++; i++; } if (cnt == 1) printf("%c", a[i-1]); else if (cnt >= 2){printf("%d", cnt-1); printf("%c", a[i-1]);} if (i < len) printf("%c", a[i]); } printf("\n"); } return 0; }
这道水题,纠结好久,唉,真是思维不严谨啊,以后输出字符类的输出的题目一定要输出到文件,不然哪里错了都看不出来,水题还这么卡,看来自己需要练练手速,还有做题的准确度。
相关文章推荐
- ZOJ 3406 Another Very Easy Task
- zoj 3406 Another Very Easy Task
- Another Very Easy Task
- HDU——1076 An easy task(水题)
- FZU1753 Another Easy Problem【组合数】
- ACdream1008:A Very Easy Triangle Counting Game
- HDU 1076 An Easy Task
- ZOJ 3802 Easy 2048 Again(状压DP+位运算)【一维状压类模板--2048】
- 杭电OJ(HDU)-ACMSteps-Chapter Two-《An Easy Task》《Buildings》《decimal system》《Vowel Counting》
- EasyDarwin Streaming Server对Task的调用方法
- HDU 2418 Another Easy Problem(模拟)
- ZOJ 3286 Very Simple Counting
- ZOJ 3802 Easy 2048 Again 状态DP
- ZOJ 3802 Easy 2048 Again(状压DP)
- (HDOJ 1076)An Easy Task
- Zoj 3947 Very Happy Great BG【水】
- 【ZOJ 3642】 Just Another Information Sharing Problem
- HDU 1076 An Easy Task
- 【思路,dp,BigInteger】ZOJ - 2598 Yet Another Digit
- ZOJ 3964 Yet Another Game of Stones(博弈论)