题解 P1538 【迎春舞会之数字舞蹈】

发布时间 2023-07-25 12:25:58作者: caijianhong

posted on 2021-06-01 13:24:05 | under 题解 | source

\(0\cdots9\) 每个数字打表,打它在相应的位置有没有一划。

然后把每个数字分成 \(5\) 部分,暴力输出即可。

#include <cstdio>
#include <cstring>
using namespace std;
const char* db[]={
    "-|| ||-",
    "  |  | ",
    "- |-| -",
    "- |- |-",
    " ||- | ",
    "-| - |-",
    "-| -||-",
    "- |  | ",
    "-||-||-",
    "-||- |-" 
};
int k,cnt;
char a[1<<8],b[1<<20],*o=b;
void P(char a,int t=1){
    memset(o,a,t);
    o+=t;
}
int main(){
    scanf("%d%s",&k,a);
    for(int q=1;q<=5;q++){
        for(int j=1;j<=(q&1?1:k);j++){
            for(int i=0;i<strlen(a);i++){
                if(i) P(' ');
                P(q&1?' ':db[a[i]-48][cnt]);
                P(q&1?db[a[i]-48][cnt]:' ',k);
                P(q&1?' ':db[a[i]-48][cnt+1]);
            }
            P('\n');
        }
        cnt+=2-(q&1);
    }
    fwrite(b,1,o-b,stdout);
    return 0;
}

bb:反正又不是用来提交的写那么认真干嘛