Submission

Status:
PP--PP--P-

Score: 50

User: kami

Problemset: ลูกเต๋า (2566)

Language: cpp

Time: 0.001 second

Submitted On: 2024-10-16 19:39:50

#include <stdio.h>

void swap(int *a, int *b){
    int temp = *a;
    *a = *b;
    *b = temp;
}

void revese(int a[]){
    int f = 0;
    int l = sizeof(a)/sizeof(a[0]);
    while(f < l){
        swap(&a[f], &a[l]);
        f++;
        l--;
    }
}

void dice(int a[]){
    revese(a);
    for(int j = 0; j < 3; j++){
        for(int i = 0 ; i < 3; i++){
            if(j == 0){
                if(a[i] == 4 || a[i] == 5 || a[i] == 6) printf("* * ");
                else if(a[i] == 2) printf(" *  ");
                else if(a[i] == 3) printf("*   ");
                else if(a[i] == 1) printf("    ");
                else printf("    ");
            }
            else if(j == 1){
                if(a[i] == 1 || a[i] == 3 || a[i] == 5) printf(" *  ");
                else if(a[i] == 2 || a[i] == 4 || a[i] == 6) printf("    ");
                else printf("    ");

            }
            else if(j == 2){
                if(a[i] == 4 || a[i] == 5 || a[i] == 6) printf("* * ");
                else if(a[i] == 3) printf("  * ");
                else if(a[i] == 2) printf(" *  ");
                else if(a[i] == 1) printf("    ");
                else printf("___ ");
            }
            
        }
        printf("\n");

    }
    
}

int main(){
    int a, b[3];
    scanf("%d",&a);
    for(int i = 0; i < 3; i++){
        b[i] = a%10;
        a/=10;
    }
    dice(b);
}