Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: modx9572

Problemset: ลูกเต๋า

Language: cpp

Time: 0.005 second

Submitted On: 2025-09-18 20:14:34

#include <stdio.h>

int main() {
    char num[100];
    scanf("%s", num);
    int length = 0;
    while (num[length] != '\0') {
        length++;
    }

    for (int i = 0; i < length; i++) {
        if (num[i] - '0' > 6) {
            printf("%s", "ERROR");
            return 0;
        }
    }

    for (int i = 0; i < 3; i++) {
        for (int k = 0; k < length; k++) {
            int currentnum = num[k] - '0';
            for (int j = 0; j < 3; j++) {
                if (currentnum == 1) {
                    if (i == j && i + j == 2) {
                        printf("%c", '*');
                    }
                    else {
                        printf("%c", ' ');
                    }
                }
                if (currentnum == 2) {
                    if (i == 1 && j != 1) {
                        printf("%c", '*');
                    }
                    else {
                        printf("%c", ' ');
                    }
                }
                if (currentnum == 3) {
                    if (j == 1) {
                        printf("%c", '*');
                    }
                    else {
                        printf("%c", ' ');
                    }
                }
                if (currentnum == 4) {
                    if ((i == j || i + j == 2) && !(i == j && i + j == 2)) {
                        printf("%c", '*');
                    }
                    else {
                        printf("%c", ' ');
                    }
                }
                if (currentnum == 5) {
                    if (i == j || i + j == 2) {
                        printf("%c", '*');
                    }
                    else {
                        printf("%c", ' ');
                    }
                }
                if (currentnum == 6) {
                    if (j != 1) {
                        printf("%c", '*');
                    }
                    else {
                        printf("%c", ' ');
                    }
                }
                

            }
            if (k != length - 1) {
            printf("%c", '|');
            }
        }
        
        printf("\n");
    }
}