zoukankan      html  css  js  c++  java
  • uva 10894

      1 #include <iostream>
      2 #include <string>
      3 #include <cstring>
      4 #include <cmath>
      5 using namespace std;
      6 
      7 int main(){
      8     //initialize for positive number
      9     char h[5][100];
     10     strcpy(h[0], "*****..***..*...*.*****...*...*.*****.*****.***...*****.*...*");
     11     strcpy(h[1], "*.....*...*.*...*.*.......*...*.*...*...*...*..*..*...*..*.*.");
     12     strcpy(h[2], "*****.*****.*...*.***.....*****.*****...*...*...*.*...*...*..");
     13     strcpy(h[3], "....*.*...*..*.*..*.......*...*.*.*.....*...*..*..*...*...*..");
     14     strcpy(h[4], "*****.*...*...*...*****...*...*.*..**.*****.***...*****...*..");
     15 
     16     //initialize for negative number
     17     char v[61][10];
     18     strcpy(v[0], "*****");
     19     strcpy(v[1], "*....");
     20     strcpy(v[2], "*****");
     21     strcpy(v[3], "....*");
     22     strcpy(v[4], "*****");
     23     strcpy(v[5], ".....");
     24     strcpy(v[6], ".***.");
     25     strcpy(v[7], "*...*");
     26     strcpy(v[8], "*****");
     27     strcpy(v[9], "*...*");
     28     strcpy(v[10],"*...*");
     29     strcpy(v[11],".....");
     30     strcpy(v[12],"*...*");
     31     strcpy(v[13],"*...*");
     32     strcpy(v[14],"*...*");
     33     strcpy(v[15],".*.*.");
     34     strcpy(v[16],"..*..");
     35     strcpy(v[17],".....");
     36     strcpy(v[18],"*****");
     37     strcpy(v[19],"*....");
     38     strcpy(v[20],"***..");
     39     strcpy(v[21],"*....");
     40     strcpy(v[22],"*****");
     41     strcpy(v[23],".....");
     42     strcpy(v[24],".....");
     43     strcpy(v[25],".....");
     44     strcpy(v[26],"*...*");
     45     strcpy(v[27],"*...*");
     46     strcpy(v[28],"*****");
     47     strcpy(v[29],"*...*");
     48     strcpy(v[30],"*...*");
     49     strcpy(v[31],".....");
     50     strcpy(v[32],"*****");
     51     strcpy(v[33],"*...*");
     52     strcpy(v[34],"*****");
     53     strcpy(v[35],"*.*..");
     54     strcpy(v[36],"*..**");
     55     strcpy(v[37],".....");
     56     strcpy(v[38],"*****");
     57     strcpy(v[39],"..*..");
     58     strcpy(v[40],"..*..");
     59     strcpy(v[41],"..*..");
     60     strcpy(v[42],"*****");
     61     strcpy(v[43],".....");
     62     strcpy(v[44],"***..");
     63     strcpy(v[45],"*..*.");
     64     strcpy(v[46],"*...*");
     65     strcpy(v[47],"*..*.");
     66     strcpy(v[48],"***..");
     67     strcpy(v[49],".....");
     68     strcpy(v[50],"*****");
     69     strcpy(v[51],"*...*");
     70     strcpy(v[52],"*...*");
     71     strcpy(v[53],"*...*");
     72     strcpy(v[54],"*****");
     73     strcpy(v[55],".....");
     74     strcpy(v[56],"*...*");
     75     strcpy(v[57],".*.*.");
     76     strcpy(v[58],"..*..");
     77     strcpy(v[59],"..*..");
     78     strcpy(v[60],"..*..");
     79 
     80     bool flag = false, pos;
     81     int n, m, i, j, k;
     82     while (cin >> n){
     83         if (n == 0) break;
     84         if (flag)
     85             cout << endl << endl;
     86         
     87         flag = true;
     88         pos = true;
     89         if (n < 0){
     90             pos = false;
     91             n = abs(n);
     92         }
     93         //output for positive number
     94         if (pos){
     95             for (i = 0; i < 5; ++i){
     96                 m = 0; 
     97                 while (m < n){
     98                     for (j = 0; h[i][j]; ++j){
     99                         k = 0;
    100                         while (k < n){
    101                             cout << h[i][j];
    102                             ++k;
    103                         }
    104                     }
    105                     ++m;
    106                     cout << endl;
    107                 }
    108             }
    109         }
    110         else{
    111             for (i = 0; i < 61; ++i){
    112                 m = 0; 
    113                 while (m < n){
    114                     for (j = 0; v[i][j]; ++j){
    115                         k = 0;
    116                         while (k < n){
    117                             cout << v[i][j];
    118                             ++k;
    119                         }
    120                     }
    121                     ++m;
    122                     cout << endl;
    123                 }
    124             }
    125         }
    126     }
    127     cout << endl << endl;
    128     return 0;
    129 }
      1 //画图题,直接打表
      2 #include <stdio.h>
      3 
      4 char h[5][62] = 
      5 {
      6 "*****..***..**.*******.*****.*****.********.**",
      7 "*..**.**.*.**.****..*..**..*.*.",
      8 "*****.*****.**.***..*****.********.***..",
      9 ".*.**..*.*..*.**.*.*..**..*..***..",
     10 "*****.**********.*..**.*****.*********.."
     11 };
     12 
     13 char v[61][6] = 
     14 {
     15 "*****",
     16 "*.",
     17 "*****",
     18 ".*",
     19 "*****",
     20 "..",
     21 ".***.",
     22 "**",
     23 "*****",
     24 "**",
     25 "**",
     26 "..",
     27 "**",
     28 "**",
     29 "**",
     30 ".*.*.",
     31 "..*..",
     32 "..",
     33 "*****",
     34 "*.",
     35 "***..",
     36 "*.",
     37 "*****",
     38 "..",
     39 "..",
     40 "..",
     41 "**",
     42 "**",
     43 "*****",
     44 "**",
     45 "**",
     46 "..",
     47 "*****",
     48 "**",
     49 "*****",
     50 "*.*..",
     51 "*..**",
     52 "..",
     53 "*****",
     54 "..*..",
     55 "..*..",
     56 "..*..",
     57 "*****",
     58 "..",
     59 "***..",
     60 "*..*.",
     61 "**",
     62 "*..*.",
     63 "***..",
     64 "..",
     65 "*****",
     66 "**",
     67 "**",
     68 "**",
     69 "*****",
     70 "..",
     71 "**",
     72 ".*.*.",
     73 "..*..",
     74 "..*..",
     75 "..*.."
     76 };
     77 
     78 void draw(int n)
     79 {
     80     if(n < 0)
     81     {
     82         n = -n;
     83         for(int i = 0; i < 61 * n; i++)
     84         {
     85             for(int j = 0; j < 5 * n; j++)
     86             {
     87                 printf("%c", v[i / n][j / n]);
     88             }
     89             printf("
    ");
     90         }
     91     }
     92     else
     93     {
     94         for(int i = 0; i < 5 * n; i++)
     95         {
     96             for(int j = 0; j < 61 * n; j++)
     97             {
     98                 printf("%c", h[i / n][j / n]);
     99             }
    100             printf("
    ");
    101         }
    102     }
    103     printf("
    
    ");
    104 }
    105 
    106 int main()
    107 {
    108     int n;
    109     while(scanf("%d", &n), n) draw(n);
    110     return 0;
    111 }
  • 相关阅读:
    python 基础类与对象函数实例
    python 练习之炮台
    python练习之银行模拟系统
    python练习之析构函数(进阶)
    python练习之__str__
    「JLOI2011」飞行路线
    「国家集训队」Crash的数字表格
    斐波那契公约数的相关证明
    「JSOI2010」满汉全席
    动态规划
  • 原文地址:https://www.cnblogs.com/aze-003/p/5114032.html
Copyright © 2011-2022 走看看