【T^T 1736】【FJUTOJ 1077】排座位

http://59.77.139.92/problem.php?id=1077

水题,小心PE

// <1736.cpp> - 11/12/16 17:17:52
// This file is made by YJinpeng,created by XuYike's black technology automatically.
// Copyright (C) 2016 ChangJun High School, Inc.
// I don't know what this program is.

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
inline int gi() {
	register int w=0,q=0;register char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')q=1,ch=getchar();
	while(ch>='0'&&ch<='9')w=w*10+ch-'0',ch=getchar();
	return q?-w:w;
}
int _x[3]={5,1,10},_y[3]={3,2,1};
char s[5][12];
int main()
{
	freopen("1736.in","r",stdin);
	freopen("1736.out","w",stdout);
    int T=gi();
    memset(s,' ',sizeof(s));
    for(int i=5;i<=8;i++)s[0][i]='X';
    for(int i=1;i<=4;i++)
        for(int o=0;o<3;o++)
            for(int j=_x[o];j<=_x[o]+_y[o];j++)
                s[i][j]='0';
    for(int i=1;i<=4;i++)s[i][4]=s[i][9]='|';
    while(T--){
        int n=gi(),x=(n-1)/9,y;
        n-=9*x;x++;
        for(int o=0;o<3;o++)
            if(_y[o]+1>=n){y=_x[o]+n-1;break;}
            else n-=_y[o]+1;
        s[x][y]='#';
        for(int j=1;j<=8;j++)putchar(s[0][j]);
        putchar('\n');
        for(int i=1;i<=4;putchar('\n'),i++)
            for(int j=1;j<=11;j++)putchar(s[i][j]);
        s[x][y]='0';
    }
	return 0;
}
posted @ 2016-11-12 18:05  _Mashiro  阅读(410)  评论(0编辑  收藏  举报