# ACdream 1188 switch教学

### Read Phone Number

Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)

#### Problem Description

Do you know how to read the phone numbers in English? Now let me tell you.

For example, In China, the phone numbers are 11 digits, like: 15012233444. Someone divides the numbers into 3-4-4 format, i.e. 150 1223 3444. While someone divides the numbers into 3-3-5 format, i.e. 150 122 33444. Different formats lead to different ways to read these numbers:

150 1223 3444 reads one five zero one double two three three triple four.

150 122 33444 reads one five zero one double two double three triple four.

Here comes the problem:

Given a list of phone numbers and the dividing formats, output the right ways to read these numbers.

Rules:

Single numbers just read them separately.

2 successive numbers use double.

3 successive numbers use triple.

4 successive numbers use quadruple.

5 successive numbers use quintuple.

6 successive numbers use sextuple.

7 successive numbers use septuple.

8 successive numbers use octuple.

9 successive numbers use nonuple.

10 successive numbers use decuple.

More than 10 successive numbers read them all separately.

#### Input

The first line of the input gives the number of test cases, T(1 ≤ T ≤ 100).

T test cases follow. Each line contains a phone number N(1 ≤ length of N ≤ 100) and the dividing format F, one or more positive integers separated by dashes (-), without leading zeros and whose sum always equals the number of digits in the phone number.

#### Output

For each test case, output one line containing "Case #x: y", where x is the case number (starting from 1) and y is the reading sentence in English whose words are separated by a space.

#### Sample Input

3
15012233444 3-4-4
15012233444 3-3-5
12223 2-3

#### Sample Output

Case #1: one five zero one double two three three triple four
Case #2: one five zero one double two double three triple four
Case #3: one two double two three

codejam

#### Manager

switch妮可真**6

#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
using namespace std;

void doubi(int num,char x){
string str;
switch(x){
case '0':str=" zero";break;
case '1':str=" one";break;
case '2':str=" two";break;
case '3':str=" three";break;
case '4':str=" four";break;
case '5':str=" five";break;
case '6':str=" six";break;
case '7':str=" seven";break;
case '8':str=" eight";break;
case '9':str=" nine";break;
}
for(int i=0;i<num;i++)
cout<<str;
return ;
}
void pr(int num,char x)
{
switch(num){
case 1:break;
case 2:cout<<" double";break;
case 3:cout<<" triple";break;
case 4:cout<<" quadruple";break;
case 5:cout<<" quintuple";break;
case 6:cout<<" sextuple";break;
case 7:cout<<" septuple";break;
case 8:cout<<" octuple";break;
case 9:cout<<" nonuple";break;
case 10:cout<<" decuple";break;
default :{
doubi(num,x);
return ;
}
}
switch(x){
case '0':cout<<" zero";break;
case '1':cout<<" one";break;
case '2':cout<<" two";break;
case '3':cout<<" three";break;
case '4':cout<<" four";break;
case '5':cout<<" five";break;
case '6':cout<<" six";break;
case '7':cout<<" seven";break;
case '8':cout<<" eight";break;
case '9':cout<<" nine";break;
}
}
int main()
{
int t;
cin>>t;
for(int p=1;p<=t;p++){
string str;
string rule;
cin>>str;
cin>>rule;
cout<<"Case #"<<p<<':';
stringstream ss;
ss<<rule;
int div=0;
int i=0;
int j=0;
while(ss>>div){
i++;
div=abs(div);//他把—当成负号了；
j+=div;
int num=1;;
for(;i<j;i++){
if(str[i-1]!=str[i]){
pr(num,str[i-1]);
num=1;
}
else
num++;
}
pr(num,str[i-1]);
}
cout<<endl;
}
}


• 本文已收录于以下专栏：

## 51nod 1188 最大公约数之和 V2

https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1188 给出一个数N，输出小于等于N的所有数，两两之间...

## LightOJ - 1188 Fast Queries(离线树状数组)

Fast Queries Given an array of N integers indexed from 1 to N, and q queries, each in the for...

## BZOJ 1188 分裂游戏 （博弈论）

1188: [HNOI2007]分裂游戏Time Limit: 10 Sec Memory Limit: 162 MB Description聪聪和睿睿最近迷上了一款叫做分裂的游戏。 该游戏的规则...
• w4149
• 2017年07月24日 21:36
• 107

## bjtuOJ 1188 素数筛选

1.素数筛选。利用了每个合数必有一个最小素因子： a.把2~n所有数依次存储在一个数组当中 b.从2开始判断一个数是否为素数，紧接着删除这个素数的所有倍数，那么剩下的数里边，最小的数就是素数。 ...

## fm1188简介

FM1188-GA1是采用SAM（小阵列麦克风）技术的SoC（系统芯片），是该公司最新推出的语音处理芯片型号。它提供了更好的噪声抑制和更好的语音质量，以及非平稳噪音抑制和优越的全双工能力。     采...

## PIXMA iP1188 series

• 2015年03月18日 19:19
• 47.47MB
• 下载

## BZOJ 1188 [HNOI2007]分裂游戏

BZOJ 1188 [HNOI2007]分裂游戏

## Solution of ZOJ 1188 DNA Sorting

One measure of unsortedness'' in a sequence is the number of pairs of entries that are out of orde...
• fduan
• 2011年05月12日 09:59
• 1615

举报原因： 您举报文章：ACdream 1188 switch教学 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)