A. 拼音魔法 ecnu
Time limit per test: 1.0 seconds
Time limit all tests: 1.0 seconds
Memory limit: 256 megabytes
Accept / Submit: 341 / 2134
魔法学校小学一年级有一种题。就是给一个字的拼音,给一个声调,让你正确地注音。但魔法老师给了巨量的题,你不用魔法根本不可能做完。所以现在要让你发明一种魔法完成这个任务。
问题已经讲完了,下面开始教授汉语。(会汉语或者自认为会汉语的可以自动跳过)
汉语中一个字的拼音由声母和韵母两部分组成,在极少数情况下也会没有声母,但一定有韵母。
一般认为,声母有 b, p, m, f, d, t, l, n, g, k, h, j, q, x, z, c, s, zh, ch, sh, r, y, w;韵母有:a, e, o, i, u, ü, ai, ei, ui, ao, ou, iu, ie, üe, er, an, en, in, un, ün, ang, eng, ing, ong。
不是所有的字母都能组合的,组合的时候有时会发生一些神奇的事情,例如 üe 变成了 ue。但是标调规则有如下口诀:
有 a 先找 a,没 a 找 o e,i u 并排标在后,这样标调不会错。
只有下面列出的元素可能会被标调。请按照下表输出(尤其注意 a 不要输出成 ɑ 了):
- 第一声:ā ē ī ō ū ǖ。
- 第二声:á é í ó ú ǘ。
- 第三声:ǎ ě ǐ ǒ ǔ ǚ。
- 第四声:à è ì ò ù ǜ。
- 轻声:a e i o u ü。
辅助材料:由教育部公布的拼音方案。如果有描述不一致的地方,请以本题描述为准。
Input
第一行一个整数 T (1≤T≤105)。
下面 T 行,每行一个拼音:拼音声调在各个拼音之后,用数字 [1-4] 进行表示。例如 zhong1 guo2
。没有数字的说明是轻声,不用标调。
按照国际惯例,输入文件全部由 ASCII 编码组成。ü
用 v
来代替。但在输出中,应仍然用 ü
来表示。
Output
对于每一组数据,输出 Case x: y
。其中 x 是从 1 开始的测试数据编号,y 是一个拼音标调后的答案。
注意:对于非 ASCII 字符的输出,请使用 UTF-8 编码。
Examples
5 zhong1 guo2 me que1 nv3
Case 1: zhōng Case 2: guó Case 3: me Case 4: quē Case 5: nǚ
#include<iostream>
#include<cstdio>
#include<string.h>
#include<math.h>
#include<string>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<queue>
#include<iomanip>
using namespace std;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;char pinyin[6] = {'a','o','e','i','u','v'};
int main()
{int n;cin >> n;int r = 1;while(n--){string words;int num;int flag = 0;cin >> words; cout << "Case "<<r << ": ";r++;int key = INF;int k = words.size()-1;if(words[k] > '0' && words[k] <'9'){num = words[k] - '0';k--;}else num = 0;int b = 0;for(int p=0;p<6;p++){for(int j=0;j<=k;j++){if(words[j] == pinyin[p]){//iuif(p == 3){if(j<k &&words[j+1] == 'u'){key = j+1;}else key = j;b = 1;break;}else if(p!=2){key = j;b=1;break;}//veif(p == 2){if( j>0 && words[j-1] == 'v'){key = j;flag = 1;}else key = j;b=1;break;}else {key = j;b=1;break;}}}if(b) break;}for(int j=0;j<=k;j++){if(flag == 1 && words[j] == 'v'){cout << string("u");continue;}if(j == key){if(words[j] == 'a'){if(num == 1) cout << string("ā");else if(num == 2) cout << string("á");else if(num == 3) cout << string("ǎ");else if(num == 4) cout << string("à");else cout << string("a");} else if(words[j] == 'o'){if(num == 1) cout << string("ō");else if(num == 2) cout << string("ó");else if(num == 3) cout << string("ǒ");else if(num == 4) cout << string("ò");else cout << string("o");}else if(words[j] == 'e'){if(num == 1) cout << string("ē");else if(num == 2) cout << string("é");else if(num == 3) cout << string("ě");else if(num == 4) cout << string("è");else cout << string("e");}else if(words[j] == 'i'){if(num == 1) cout << string("ī");else if(num == 2) cout << string("í");else if(num == 3) cout << string("ǐ");else if(num == 4) cout << string("ì");else cout << string("i");}else if(words[j] == 'u'){if(num == 1) cout << string("ū");else if(num == 2) cout << string("ú");else if(num == 3) cout << string("ǔ");else if(num == 4) cout << string("ù");else cout << string("u");}else{if(num == 1) cout << string("ǖ");else if(num == 2) cout << string("ǘ");else if(num == 3) cout << string("ǚ");else if(num == 4) cout << string("ǜ");else cout << string("ü");}}else cout << words[j];}cout << '\n';}
}
A. 拼音魔法 ecnu相关推荐
- 拼音魔法 使用switch case简化复杂的if else
A. 拼音魔法 原题链接 魔法学校小学一年级有一种题.就是给一个字的拼音,给一个声调,让你正确地注音.但魔法老师给了巨量的题,你不用魔法根本不可能做完.所以现在要让你发明一种魔法完成这个任务. 问题已 ...
- 拼音魔法-华东师范大学程序设计竞赛-ecnu3256
拼音魔法click here 模拟题,轻声判断v转换为u还是ü:1至4升是一样的解法.先判断有无a o e, 若有,替换为带声调的:若无,继续判断有无i u,若有,替换:若无,继续判断有无v,若有,替 ...
- EOJ 3256:拼音魔法
拼音魔法 Time limit per test: 1.0 seconds Time limit all tests: 1.0 seconds Memory limit: 256 megabytes ...
- 2017华东师范大学网赛-拼音魔法
拼音魔法 Time limit per test: 1.0 seconds Time limit all tests: 1.0 seconds Memory limit: 256 megabytes ...
- A. 拼音魔法(模拟)
摸了200+,丢人啊 A. 拼音魔法 Time limit per test: 1.0 seconds Time limit all tests: 1.0 seconds Memory limit: ...
- EOJ 3256 拼音魔法(string+char[]的使用技巧)
拼音魔法 Time limit per test: 1.0 seconds Time limit all tests: 1.0 seconds Memory limit: 256 megabytes ...
- 2017大学生程序设计邀请赛(华东师范大学) A.拼音魔法
传送门:http://acm.ecnu.edu.cn/problem/3256/ 魔法学校小学一年级有一种题.就是给一个字的拼音,给一个声调,让你正确地注音.但魔法老师给了巨量的题,你不用魔法根本不可 ...
- EOJ 3256 拼音魔法 【模拟】
题目链接:EOJ 3256 Description: 魔法学校小学一年级有一种题.就是给一个字的拼音,给一个声调,让你正确地注音.但魔法老师给了巨量的题,你不用魔法根本不可能做完.所以现在要让你发明一 ...
- EOJ 3256 拼音魔法 题解
题意 魔法学校小学一年级有一种题.就是给一个字的拼音,给一个声调,让你正确地注音.但魔法老师给了巨量的题,你不用魔法根本不可能做完.所以现在要让你发明一种魔法完成这个任务. 问题已经讲完了,下面开始教 ...
最新文章
- c语言统计单词字母个数,C语言统计单词个数
- 利剑无意之面试题(一)
- 如何查询 ABAP 传输请求(Transport Request)和使用该请求修改了的程序的信息?
- 描述符演练-02-逻辑疏理-类的装饰器
- 创建可用实验快照(二)
- 面对数据缺失,如何选择合适的机器学习模型?
- 第十三周项目1-数组大折腾(一)
- iis中间件_.NET Core技术研究中间件的由来和使用
- 修改服务器控件的ID和Name
- 计算机管理3d设置在哪,NVIDIA控制面板设置方法(图解)
- python打印质数(素数)
- 【jzoj2173】【DFS】无根树
- 【CV】细粒度图像分割 (FGIS)
- 网站服务器无法打开ie,internet explorer无法打开站点怎么办
- ios 微信登录sdk集成
- Windows MySQL 下载及安装教程
- 【ppt入门教程】PowerPoint课件发布全攻略
- iPhoneX适配问题 iOS刘海屏 安全区域处理 IOS小黑条处理 IOS兼容处理
- 中国分省30米DEM(NASA 2020版)
- 计算机和建筑学薪资待遇区别,工科中薪资待遇最高、女生最多、毕业后竞争最激烈的前两名专业!...