zoukankan      html  css  js  c++  java
  • 找规律 Codeforces Round #290 (Div. 2) A. Fox And Snake

    题目传送门

     1 /*
     2     水题
     3     找规律输出
     4 */
     5 #include <cstdio>
     6 #include <iostream>
     7 #include <cstring>
     8 #include <string>
     9 #include <map>
    10 #include <algorithm>
    11 #include <vector>
    12 #include <set>
    13 #include <cmath>
    14 using namespace std;
    15 
    16 const int MAXN = 1e6 + 10;
    17 const int INF = 0x3f3f3f3f;
    18 
    19 int main(void)
    20 {
    21     //freopen ("A.in", "r", stdin);
    22     
    23     string s[4];
    24     int n, m;
    25     
    26     while (cin >> n >> m)
    27     {
    28         for (int i=1; i<=3; ++i)
    29         {
    30             s[i] = "";
    31         }
    32         for (int i=0; i<=m-1; ++i)
    33         {
    34             s[1] += '#';
    35             if (i != m - 1) s[2] += '.';
    36             else    s[2] += '#';
    37             if (i == 0) s[3] += '#';
    38             else    s[3] += '.';
    39         }
    40 
    41         int x = n / 4;
    42 
    43         for (int i=1; i<=x; ++i)
    44         {
    45             cout << s[1] << endl;
    46             cout << s[2] << endl;
    47             cout << s[1] << endl;
    48             cout << s[3] << endl;
    49         }
    50 
    51         int y = n % 4;
    52 
    53         for (int i=1; i<=y; ++i)
    54         {
    55             if (i == 3) cout << s[1] << endl;
    56             else    cout << s[i] << endl;
    57         }
    58     }
    59     
    60     return 0;
    61 }
    编译人生,运行世界!
  • 相关阅读:
    CSS hack
    字符串中常用的方法
    排序算法
    拾遗
    数组类型检测
    数组常用的方法
    go 文件服务器(标准库) 添加关机,睡眠,退出功能
    go cmd 交互 初始化执行某些命令
    go 内网IP及外网IP获取
    go 快排实现
  • 原文地址:https://www.cnblogs.com/Running-Time/p/4366702.html
Copyright © 2011-2022 走看看