uva 10894 - Save Hridoy
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
using namespace std; int main(){
//initialize for positive number
char h[][];
strcpy(h[], "*****..***..*...*.*****...*...*.*****.*****.***...*****.*...*");
strcpy(h[], "*.....*...*.*...*.*.......*...*.*...*...*...*..*..*...*..*.*.");
strcpy(h[], "*****.*****.*...*.***.....*****.*****...*...*...*.*...*...*..");
strcpy(h[], "....*.*...*..*.*..*.......*...*.*.*.....*...*..*..*...*...*..");
strcpy(h[], "*****.*...*...*...*****...*...*.*..**.*****.***...*****...*.."); //initialize for negative number
char v[][];
strcpy(v[], "*****");
strcpy(v[], "*....");
strcpy(v[], "*****");
strcpy(v[], "....*");
strcpy(v[], "*****");
strcpy(v[], ".....");
strcpy(v[], ".***.");
strcpy(v[], "*...*");
strcpy(v[], "*****");
strcpy(v[], "*...*");
strcpy(v[],"*...*");
strcpy(v[],".....");
strcpy(v[],"*...*");
strcpy(v[],"*...*");
strcpy(v[],"*...*");
strcpy(v[],".*.*.");
strcpy(v[],"..*..");
strcpy(v[],".....");
strcpy(v[],"*****");
strcpy(v[],"*....");
strcpy(v[],"***..");
strcpy(v[],"*....");
strcpy(v[],"*****");
strcpy(v[],".....");
strcpy(v[],".....");
strcpy(v[],".....");
strcpy(v[],"*...*");
strcpy(v[],"*...*");
strcpy(v[],"*****");
strcpy(v[],"*...*");
strcpy(v[],"*...*");
strcpy(v[],".....");
strcpy(v[],"*****");
strcpy(v[],"*...*");
strcpy(v[],"*****");
strcpy(v[],"*.*..");
strcpy(v[],"*..**");
strcpy(v[],".....");
strcpy(v[],"*****");
strcpy(v[],"..*..");
strcpy(v[],"..*..");
strcpy(v[],"..*..");
strcpy(v[],"*****");
strcpy(v[],".....");
strcpy(v[],"***..");
strcpy(v[],"*..*.");
strcpy(v[],"*...*");
strcpy(v[],"*..*.");
strcpy(v[],"***..");
strcpy(v[],".....");
strcpy(v[],"*****");
strcpy(v[],"*...*");
strcpy(v[],"*...*");
strcpy(v[],"*...*");
strcpy(v[],"*****");
strcpy(v[],".....");
strcpy(v[],"*...*");
strcpy(v[],".*.*.");
strcpy(v[],"..*..");
strcpy(v[],"..*..");
strcpy(v[],"..*.."); bool flag = false, pos;
int n, m, i, j, k;
while (cin >> n){
if (n == ) break;
if (flag)
cout << endl << endl; flag = true;
pos = true;
if (n < ){
pos = false;
n = abs(n);
}
//output for positive number
if (pos){
for (i = ; i < ; ++i){
m = ;
while (m < n){
for (j = ; h[i][j]; ++j){
k = ;
while (k < n){
cout << h[i][j];
++k;
}
}
++m;
cout << endl;
}
}
}
else{
for (i = ; i < ; ++i){
m = ;
while (m < n){
for (j = ; v[i][j]; ++j){
k = ;
while (k < n){
cout << v[i][j];
++k;
}
}
++m;
cout << endl;
}
}
}
}
cout << endl << endl;
return ;
}
//画图题,直接打表
#include <stdio.h> char h[][] =
{
"*****..***..**.*******.*****.*****.********.**",
"*..**.**.*.**.****..*..**..*.*.",
"*****.*****.**.***..*****.********.***..",
".*.**..*.*..*.**.*.*..**..*..***..",
"*****.**********.*..**.*****.*********.."
}; char v[][] =
{
"*****",
"*.",
"*****",
".*",
"*****",
"..",
".***.",
"**",
"*****",
"**",
"**",
"..",
"**",
"**",
"**",
".*.*.",
"..*..",
"..",
"*****",
"*.",
"***..",
"*.",
"*****",
"..",
"..",
"..",
"**",
"**",
"*****",
"**",
"**",
"..",
"*****",
"**",
"*****",
"*.*..",
"*..**",
"..",
"*****",
"..*..",
"..*..",
"..*..",
"*****",
"..",
"***..",
"*..*.",
"**",
"*..*.",
"***..",
"..",
"*****",
"**",
"**",
"**",
"*****",
"..",
"**",
".*.*.",
"..*..",
"..*..",
"..*.."
}; void draw(int n)
{
if(n < )
{
n = -n;
for(int i = ; i < * n; i++)
{
for(int j = ; j < * n; j++)
{
printf("%c", v[i / n][j / n]);
}
printf("\n");
}
}
else
{
for(int i = ; i < * n; i++)
{
for(int j = ; j < * n; j++)
{
printf("%c", h[i / n][j / n]);
}
printf("\n");
}
}
printf("\n\n");
} int main()
{
int n;
while(scanf("%d", &n), n) draw(n);
return ;
}
uva 10894 - Save Hridoy的更多相关文章
- UVA - 11986 Save from Radiation
Description J Save from Radiation Most of you are aware of Nuclear Power Plant Explosion at Fukushim ...
- UVa 12403 - Save Setu
题目:有两种操作:1.当前数值添加.2.输出当前数值. 分析:简单题.模拟就可以. 说明:A+B. #include <iostream> #include <cstdlib> ...
- UVA 1291 十四 Dance Dance Revolution
Dance Dance Revolution Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Su ...
- UVA 322 ships (POJ 1138)
题目地址: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem ...
- UVA它11292 - Dragon of Loowater
Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance tur ...
- UVA 257 - Palinwords(弦HASH)
UVA 257 - Palinwords 题目链接 题意:输出一个文本里面的palinword,palinword的定义为.包括两个不同的回文子串,而且要求回文子串不能互相包括 思路:对于每一个单词推 ...
- UVA 11292 Dragon of Loowater(简单贪心)
Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance tur ...
- UVA 1341 - Different Digits(数论)
UVA 1341 - Different Digits 题目链接 题意:给定一个正整数n.求一个kn使得kn上用的数字最少.假设同样,则输出值最小的 思路: 首先利用鸽笼原理证明最多须要2个数字去组成 ...
- Risk UVA - 12264 拆点法+最大流+二分 最少流量的节点流量尽量多。
/** 题目:Risk UVA - 12264 链接:https://vjudge.net/problem/UVA-12264 题意:给n个点的无权无向图(n<=100),每个点有一个非负数ai ...
随机推荐
- php批量上传图片并把图片名放入数据库
前几天工作中要做这样一个功能,有八百多个系统 生成的会员:给这八百多个系统会员上传图片:然后把图片名放入数据库. 第一步: 第一步肯定是首先把图片上传到对应的图片目录下,直接用框架中已经有的上传类: ...
- 魔法方法:算术运算 - 零基础入门学习Python042
魔法方法:算术运算 让编程改变世界 Change the world by program 我现在重新提一个名词:工厂函数,不知道大家还有没有印象?我们在老早前就提到过Ta,由于那时候我们还没有学习类 ...
- 【学习笔记】【Foundation】集合Set
不可变集合 NSSet :集合元素无顺序,没有索引号,元素不可重复. NSSet在功能上可看做是NSArray的父集,它是一个更通用的类. NSSet包含如下常用方法: setByAddingObje ...
- 图的建立——邻接矩阵表示(C语言+VC6.0平台)
图的邻接矩阵表示及其建立(无向图) #include <stdio.h> #include <stdlib.h> typedef char VertexType; ...
- Swift—静态方法-备
静态方法与静态属性类似,Swift中定义了静态方法,也称为类型方法.静态方法的定义与静态属性类似,枚举和结构体的静态方法使用的关键字是static:类静态方法使用的关键字是class或static,如 ...
- PHP中的常量
常量与变量不一样,一旦被定义就可以全局访问. 例如: <?php define('CONST_NAME','shiyingyan'); define('RESULT_OK',1); define ...
- TCP粘包的拆包处理
因为TCP是流式处理的,所以包没有边界,必须设计一个包头,里面表示包的长度(一般用字节表示),根据这个来逐个拆包.如果对于发送/接收频率不高的话,一般也就不做拆包处理了,因为不大可能有粘包现象. 以下 ...
- PL/SQL 包头和包体
包用于逻辑组合相关的过程和函数,它由包规范和包体两部分组成,包规范用于定义公用的常量 变量,过程和函数,在SQL*PLUS中建立包规范可以使用CREATE PACKAGE命令. 实例如下: CREAT ...
- Linux下安装GCC5.3.0(亲测有效)
对于linux小白来说,只需要先知道怎么安装,至于为什么等学了linux再说吧..知识不系统的坏处啊! 首先,一般ubuntu上都预装了低级版本的Gcc,完全可以应付刷OJ时的C+Class+STL的 ...
- libvirt-adabddad
kvm i686 libvirtError: internal error cannot load AppArmor profile 'libvirt-adabddad-35ba-b9ca-e250 ...