Submission

Status:

-----PP---

Subtask/Task Score:

20/100

Score: 20

User: theem1502

Problemset: ลูกเต๋า

Language: c

Time: 0.002 second

Submitted On: 2025-09-11 20:37:55

#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", ' ');
                    }
                }
                

            }
            printf("%c", '|');
        }

        printf("\n");
    }
}