nyoj 25-A Famous Music Composer(字符串)
25-A Famous Music Composer
内存限制:64MB
时间限制:1000ms
Special Judge: No
accepted:4
submit:9
题目描述:
| A | A#=Bb | B | C | C#=Db | D | D#=Eb | E | F | F#=Gb | G | G#=Ab |
| Ab minor | A# major | A# minor | C# major | Db minor |
| D# major | D# minor | Gb major | Gb minor | G# major |
输入描述:
Each test case is described by one line having the format "note tonality", where "note" is one of the 17 names for the scale notes given above, and "tonality" is either "major" or "minor" (quotes for clarify).
输出描述:
For each case output the required answer, following the format of the sample.
样例输入:
Ab minor
D# major
G minor
样例输出:
Case 1: G# minor
Case 2: Eb major
Case 3: UNIQUE 题目大意:
①、每一行,给你两个字符串,判断第一个字符串是否属于表格一中有“=”符号的字符串,属于就输出与之相同的字符串,至于第二个字符串,照抄下来就行了,但是如果不属于有“=”连接的字符串,就要输出UNIQUE 分析:
①、我们可以看出具有“=”关系的前三个字符第一个元素差1,而第二个相对固定,酱紫考虑问题就简洁很多了 核心代码:
if(s1[] == '#')
{
if(s1[] == 'G')
printf("Ab %s\n", s2);
else
printg("%cb %s\n", s1[]+, s2);
}
else if(s1[] == 'b')
{
if(s1[] == 'A')
printf("G# %s\n", s2);
else
printf("%c# %s\n", s1[]-, s2);
}
else
{
printf("UNIQUE\n");
}
C/C++代码实现(AC):
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <stack> using namespace std; int main ()
{
char s1[], s2[];
int cnt = ;
while(~scanf("%s %s", &s1[], &s2[]))
{
printf("Case %d: ", cnt ++);
if(s1[] == '#')
{
if(s1[] == 'G')
{
printf("Ab %s\n", s2);
}
else
{
printf("%cb %s\n", s1[]+, s2);
}
}
else if(s1[] == 'b')
{
if(s1[] == 'A')
{
printf("G# %s\n", s2);
}
else
{
printf("%c# %s\n", s1[]-, s2);
}
}
else
{
printf("UNIQUE\n");
}
}
return ;
}
nyoj 25-A Famous Music Composer(字符串)的更多相关文章
- NYOJ 25 A Famous Music Composer
A Famous Music Composer 时间限制:1000 ms | 内存限制:65535 KB 难度:1 描述 Mr. B is a famous music composer. O ...
- 25.A Famous Music Composer
描述 Mr. B is a famous music composer. One of his most famous work was his set of preludes. These 24 p ...
- 07-语言入门-07-A Famous Music Composer
题目地址: http://blog.csdn.net/sevenmit/article/details/8231994 描述 Mr. B is a famous music composer. On ...
- A Famous Music Composer
描述 Mr. B is a famous music composer. One of his most famous work was his set of preludes. These 24 p ...
- nyoj25-A Famous Music Composer
A Famous Music Composer 时间限制:1000 ms | 内存限制:65535 KB 难度:1 描述 Mr. B is a famous music composer. One ...
- NYOJ 305 表达式求值 (字符串处理)
题目链接 描述 Dr.Kong设计的机器人卡多掌握了加减法运算以后,最近又学会了一些简单的函数求值,比如,它知道函数min(20,23)的值是20 ,add(10,98) 的值是108等等.经过训练, ...
- NYOJ 35 表达式求值 (字符串处理)
题目链接 描述 ACM队的mdd想做一个计算器,但是,他要做的不仅仅是一计算一个A+B的计算器,他想实现随便输入一个表达式都能求出它的值的计算器,现在请你帮助他来实现这个计算器吧. 比如输入:&quo ...
- PAT A1110 Complete Binary Tree (25 分)——完全二叉树,字符串转数字
Given a tree, you are supposed to tell if it is a complete binary tree. Input Specification: Each in ...
- PAT A1028 List Sorting (25 分)——排序,字符串输出用printf
Excel can sort records according to any column. Now you are supposed to imitate this function. Input ...
随机推荐
- Echart:前端很好的数据图表展现工具+demo
官网: http://echarts.baidu.com/index.html 通过一个简单的小Demo介绍echart的使用:demo均亲测可以运行 demo1: 1.新建一个echarts.ht ...
- 就改了get,却不让我set?——Java内省机制的神奇行为举止一例
[相关类库]org.apache.commons.beanutils.BeanUtils,提供对Java反射和自省API的包装,其中底层使用到了Java的内省方法.[内省的一般应用形式]通过类Intr ...
- 【OUC2019写作】论文写作第九小组英语常用表达整理
第一部分: 一.简要综述以往和现在研究: 某方法被认为如何如何:it is well known that; it is regarded as; it is believed to ; It is ...
- 9.Linux用户管理(下)
1. 为用户添加密码 [root才能执行] 1为新用户添加密码{只能是root} {密码尽可能的复杂} [0-9][a-Z][a-Z] [!@#$%^&]* [root@yinwucheng ...
- LaTeX常用篇(一)---公式输入
目录 1. 序言 2. 命令介绍 3. 公式输入 3.1 无编号公式 3.2 有编号公式 更新时间:2019.10.02 1. 序言 当我们首次在文档中输入公式的时候,我们首先想到的是word,毕 ...
- 包管理-rpm
rpm包管理 程序源代码---->预处理---->编译---->汇编---->链接 数据处理 转为汇编代码 进行汇编 引入库文件 静态编译:. ...
- iOS Undefined ..Arm64问题解决
Undefined symbols for architecture arm64 此问题由一下集中解决办法: 1)如果是引用第三方库导致则把第三方库删除重新添加一下,若果不行在添加如下几个依赖库 如 ...
- jquery获取dom属性方法
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- vue-cli安装方法
vue-cli:vue文件,css文件,less文件,图片--->htmles6代码--->es5代码 template标签里面,只能有1个跟元素 script标签里面导入组件import ...
- Map文件从IDA到OD
目录 什么是map文件 IDA与OD导出使用map文件 注意事项 使用OD载入导出的map文件 什么是map文件 什么是 MAP 文件? 简单地讲, MAP 文件是程序的全局符号.源文件和代码行号信息 ...