zoukankan      html  css  js  c++  java
  • 牛客小白月赛1 F 三视图 【循环】

    题目链接

    https://www.nowcoder.com/acm/contest/85/F

    思路
    记录每一个面 上的点 是否有方块

    然后 根据它的输出顺序 遍历访问 如果有 输出 ‘X’ 否则 输出‘.’

    但是要注意它的坐标系不是常规的坐标系

    AC代码

    #include <cstdio>
    #include <cstring>
    #include <ctype.h>
    #include <cstdlib>
    #include <cmath>
    #include <climits>
    #include <ctime>
    #include <iostream>
    #include <algorithm>
    #include <deque>
    #include <vector>
    #include <queue>
    #include <string>
    #include <map>
    #include <stack>
    #include <set>
    #include <numeric>
    #include <sstream>
    #include <iomanip>
    #include <limits>
    
    #define CLR(a) memset(a, 0, sizeof(a))
    
    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    typedef pair <int, int> pii;
    typedef pair <ll, ll> pll;
    
    const double PI  = 3.14159265358979323846264338327;
    const double E   = exp(1);
    const double eps = 1e-6;
    
    const int INF    = 0x3f3f3f3f;
    const int maxn   = 1e3 + 5;
    const int MOD    = 1e9 + 7;
    
    int xoy[maxn][maxn], xoz[maxn][maxn], yoz[maxn][maxn];
    
    int main()
    {
        CLR(xoy);
        CLR(xoz);
        CLR(yoz);
        int x, y, z, n;
        scanf("%d%d%d%d", &x, &y, &z, &n);
        for (int i = 0; i < n; i++)
        {
            int a, b, c;
            scanf("%d%d%d", &a, &b, &c);
            xoy[a][b] = 1;
            xoz[a][c] = 1;
            yoz[b][c] = 1;
        }
        for (int i = y; i >= 1; i--)
        {
            for (int j = 1; j <= x; j++)
            {
                if (xoy[j][i])
                    printf("x");
                else
                    printf(".");
            }
            printf(" ");
            for (int j = 1; j <= z; j++)
            {
                if (yoz[i][j])
                    printf("x");
                else
                    printf(".");
            }
            printf("
    ");
        }
        printf("
    ");
        for (int i = 1; i <= z; i++)
        {
            for (int j = 1; j <= x; j++)
            {
                if (xoz[j][i])
                    printf("x");
                else
                    printf(".");
            }
            printf("
    ");
        }
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  • 相关阅读:
    koa2 + webpack 热更新
    koa2在node6中如何运行
    浅拷贝和深拷贝的理解和实现
    angular2多组件通信流程图
    angular2 表单的理解
    ssh-add Could not open a connection to your authentication agent.
    outlook同步异常
    ctrl+c ctrl+d ctrl+z 的区别和使用场景
    grep 详解
    mysql 事务隔离级别 详解
  • 原文地址:https://www.cnblogs.com/Dup4/p/9433238.html
Copyright © 2011-2022 走看看