NJU 1010 Air

时间:2022-02-05 04:37:43

思路:把那张图打表(吐血...),然后就按照规则输出就行。

AC代码

#include <cstdio>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <cstring>
#include <utility>
#include <string>
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <stack>
using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")
#define eps 1e-10
#define inf 0x3f3f3f3f
#define PI pair<int, int>
typedef long long LL;
const int maxn = 50 + 5;
string a[maxn];

void init() {
	for(int i = 0; i <= 35; ++i) {
		if(i == 0) a[i] = ".-";
		else if(i == 1) a[i] = "-...";
		else if(i == 2) a[i] = "-.-.";
		else if(i == 3) a[i] = "-..";
		else if(i == 4) a[i] = ".";
		else if(i == 5) a[i] = "..-.";
		else if(i == 6) a[i] = "--.";
		else if(i == 7) a[i] = "....";
		else if(i == 8) a[i] = "..";
		else if(i == 9) a[i] = ".---";
		else if(i == 10) a[i] = "-.-";
		else if(i == 11) a[i] = ".-..";
		else if(i == 12) a[i] = "--";
		else if(i == 13) a[i] = "-.";
		else if(i == 14) a[i] = "---";
		else if(i == 15) a[i] = ".--.";
		else if(i == 16) a[i] = "--.-";
		else if(i == 17) a[i] = ".-.";
		else if(i == 18) a[i] = "...";
		else if(i == 19) a[i] = "-";
		else if(i == 20) a[i] = "..-";
		else if(i == 21) a[i] = "...-";
		else if(i == 22) a[i] = ".--";
		else if(i == 23) a[i] = "-..-";
		else if(i == 24) a[i] = "-.--";
		else if(i == 25) a[i] = "--..";
		else if(i == 26) a[i] = "-----";
		else if(i == 27) a[i] = ".----";
		else if(i == 28) a[i] = "..---";
		else if(i == 29) a[i] = "...--";
		else if(i == 30) a[i] = "....-";
		else if(i == 31) a[i] = ".....";
		else if(i == 32) a[i] = "-....";
		else if(i == 33) a[i] = "--...";
		else if(i == 34) a[i] = "---..";
		else if(i == 35) a[i] = "----.";
	}
	for(int i = 0; i <= 35; ++i) {
		string s = a[i];
		a[i].clear();
		for(int j = 0; j < s.size(); ++j) {
			if(s[j] == '.') a[i].push_back('=');
			else for(int k = 0; k < 3; ++k) a[i].push_back('=');
			if(j < s.size()-1) a[i].push_back('.');
		}
	}
}

int main() {
	init();
	int T, n, kase = 1;
	char s[25];
	scanf("%d", &T);
	while(T--) {
		printf("Case #%d: ", kase++);
		scanf("%d", &n);
		for(int i = 0; i < n; ++i) {
			scanf("%s", s);
			for(int j = 0; j < strlen(s); ++j) {
				s[j] = toupper(s[j]);
				if(s[j] >= 'A' && s[j] <= 'Z') {
					cout << a[s[j]-'A'];
				}
				else cout << a[s[j]-'0'+26];
				if(j != strlen(s)-1) printf("...");
			}
			if(i != n-1) printf(".......");
		}
		printf("\n");
	}
	return 0;
}

如有不当之处欢迎指出!

NJU 1010 Air的更多相关文章

  1. poj——1422 Air Raid

    Air Raid Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 8577   Accepted: 5127 Descript ...

  2. HDU 4756 Install Air Conditioning(次小生成树)

    题目大意:给你n个点然后让你求出去掉一条边之后所形成的最小生成树. 比較基础的次小生成树吧. ..先prime一遍求出最小生成树.在dfs求出次小生成树. Install Air Conditioni ...

  3. BZOJ 1010&colon; &lbrack;HNOI2008&rsqb;玩具装箱toy &lbrack;DP 斜率优化&rsqb;

    1010: [HNOI2008]玩具装箱toy Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 9812  Solved: 3978[Submit][St ...

  4. Entity Framework 6 Recipes 2nd Edition(10-10)译 - &gt&semi; 为TPH继承的插入、更新、删除操作映射到存储过程

    10-10. 为TPH继承的插入.更新.删除操作映射到存储过程 问题 TPH继承模型,想把它的插入.修改.删除操作映射到存储过程 Solution 假设数据库有一个描述不同种类的产品表(Product ...

  5. ERROR 1010 &lpar;HY000&rpar;&colon; Error dropping database &lpar;can&&num;39&semi;t rmdir &&num;39&semi;&period;&sol;test&sol;&&num;39&semi;&comma; errno&colon; 17&rpar;

    在删除数据库的时候报标题所示错误 mysql> drop database test; ERROR (HY000): Error dropping database (can't rmdir ' ...

  6. 解决adobe air sdk打包 apk后自动在包名前面加上air&period; &lpar;有个点&rpar;前缀的问题

    早就找到了这个方法,但是一直忙没心思写博客. 默认情况下,所有 AIR Android 应用程序的包名称都带 air 前缀.若不想使用此默认行为,可将计算机环境变量 AIR_NOANDROIDFLAI ...

  7. adobe air类app 接入腾讯开放平台移动游戏使用带tencent包名前缀的问题

    作者:Panda Fang 出处:http://www.cnblogs.com/lonkiss/p/4209159.html 原创文章,转载请注明作者和出处,未经允许不可用于商业营利活动 ------ ...

  8. Adobe AIR 中为不同尺寸和分辨率屏幕适配

    在 Adobe AIR 中为不同屏幕尺寸的多种设备提供支持 http://www.adobe.com/cn/devnet/air/articles/multiple-screen-sizes.html ...

  9. Ural 1010&period; Discrete Function

    1010. Discrete Function Time limit: 1.0 secondMemory limit: 64 MB There is a discrete function. It i ...

随机推荐

  1. Java JDBC下执行SQL的不同方式、参数化预编译防御

    相关学习资料 http://zh.wikipedia.org/wiki/Java数据库连接 http://lavasoft.blog.51cto.com/62575/20588 http://blog ...

  2. Java对象的序列化与反序列化:默认格式及JSON格式(使用jackson)

    我的技术博客经常被流氓网站恶意爬取转载.请移步原文:http://www.cnblogs.com/hamhog/p/3558663.html,享受整齐的排版.有效的链接.正确的代码缩进.更好的阅读体验 ...

  3. HDU-2710 Max Factor

    看懂: Max Factor Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) T ...

  4. 一则 Mysql 建表语句

    DROP TABLE IF EXISTS `nuvue`; CREATE TABLE `nuvue`( `id` ) UNSIGNED NOT NULL AUTO_INCREMENT, `status ...

  5. VC&plus;&plus;6&period;0出现no compile tool is associated with the extension&period;解决方法

    对于刚解除VC++6.0的小白,在编译时候经常出现下图的错误提示: 解释为:不能编译此BmpRot.h文件,没有合适的编译工具可以编译此扩展名的文件. 很明显,当然只有.cpp文件才能编译. .h头文 ...

  6. discuz二次开发笔记(三)------discuz的安装步骤

    下载好discuz的安装包后,解压在自己定义的文件夹里面,将upload里面的文件拷贝出来放到和upload同级的地方,然后删除upload文件夹. 打开浏览器,输入你文件夹的地址:如:http:// ...

  7. jmeter连接oracle数据库配置

    1导入加载ojdbc.jar包(2种方法) 1)直接拷贝目录 2.

  8. &lbrack;Vue warn&rsqb;&colon; You are using the runtime-only build of Vue where the template compiler is not available&period; Either pre-compile the templates into render functions&comma; or use the compiler-included build&period;

    转载自:https://segmentfault.com/a/1190000006435886 解决办法:添加package.config.js配置文件中,添加本文章的红色部分代码 import vu ...

  9. 杭电acm 1033题

    Problem Description For products that are wrapped in small packings it is necessary that the sheet o ...

  10. UIDeviceOrientation 和 UIInterfaceOrientation

    有时候,我们处理自动布局时,需要获取到屏幕旋转方向: 以下为本人亲测: UIInterfaceOrientation: 我们需要在- (void)viewDidLoad或其他方法中添加观察者,检测屏幕 ...