Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: karnsinee

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

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-13 20:57:00

#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
	int a,x,y,z;
	scanf("%d",&a);
	x=a/100;
	y=(a-(100*x))/10;
	z=a%10;
	//printf("%d %d %d",x,y,z);
	char m[3][3];
	int n[3][3];
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			if(x==1){
				if(i==1&&j==1){
					m[i][j]='*';
				}
				else{
					m[i][j]=' ';
				}
				
			}
			else if(x==2){
				if(i==0&&j==1||i==2&&j==1){
					m[i][j]='*';
				}
				else{
					m[i][j]=' ';
				}
			}
			else if(x==3){
				if(i==j){
					m[i][j]='*';
				}
				else{
					m[i][j]=' ';
				}
			}
			else if(x==4){
				if(i==0&&j==0||i==0&&j==2||i==2&&j==0||i==2&&j==2){
					m[i][j]='*';
				}
				else{
					m[i][j]=' ';
				}
			}
			else if(x==5){
				if(i==0&&j==0||i==0&&j==2||i==2&&j==0||i==2&&j==2||i==1&&j==1){
					m[i][j]='*';
				}
				else{
					m[i][j]=' ';
				}
			}
			else if(x==6){
				if(j==0||j==2){
					m[i][j]='*';
				}
				else{
					m[i][j]=' ';
				}
			}
			else{
				if(i==2){
					m[i][j]='___';
				}
				else{
					m[i][j]=' ';
				}
				
			}
			
			
		}
	}
	
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			if(y==1){
				if(i==1&&j==1){
					n[i][j]='*';
				}
				else{
					n[i][j]=' ';
				}
				
			}
			else if(y==2){
				if(i==0&&j==1||i==2&&j==1){
					n[i][j]='*';
				}
				else{
					n[i][j]=' ';
				}
			}
			else if(y==3){
				if(i==j){
					n[i][j]='*';
				}
				else{
					n[i][j]=' ';
				}
			}
			else if(y==4){
				if(i==0&&j==0||i==0&&j==2||i==2&&j==0||i==2&&j==2){
					n[i][j]='*';
				}
				else{
					n[i][j]=' ';
				}
			}
			else if(y==5){
				if(i==0&&j==0||i==0&&j==2||i==2&&j==0||i==2&&j==2||i==1&&j==1){
					n[i][j]='*';
				}
				else{
					n[i][j]=' ';
				}
			}
			else if(y==6){
				if(j==0||j==2){
					n[i][j]='*';
				}
				else{
					n[i][j]=' ';
				}
			}
			else{
				if(i==2){
					n[i][j]='___';
				}
				else{
					n[i][j]=' ';
				}
				
			}
			
			
		}
	}
	char o[3][3];
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			if(z==1){
				if(i==1&&j==1){
					o[i][j]='*';
				}
				else{
					o[i][j]=' ';
				}
				
			}
			else if(z==2){
				if(i==0&&j==1||i==2&&j==1){
					o[i][j]='*';
				}
				else{
					o[i][j]=' ';
				}
			}
			else if(z==3){
				if(i==j){
					o[i][j]='*';
				}
				else{
					o[i][j]=' ';
				}
			}
			else if(z==4){
				if(i==0&&j==0||i==0&&j==2||i==2&&j==0||i==2&&j==2){
					o[i][j]='*';
				}
				else{
					o[i][j]=' ';
				}
			}
			else if(z==5){
				if(i==0&&j==0||i==0&&j==2||i==2&&j==0||i==2&&j==2||i==1&&j==1){
					o[i][j]='*';
				}
				else{
					o[i][j]=' ';
				}
			}
			else if(z==6){
				if(j==0||j==2){
					o[i][j]='*';
				}
				else{
					o[i][j]=' ';
				}
			}
			else{
				if(i==2){
					o[i][j]='___';
				}
				else{
					o[i][j]=' ';
				}
				
			}
			
			
		}
	}
	
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			printf("%c",m[i][j]);
		}
		cout<<" ";
		for(int j=0;j<3;j++){
			printf("%c",n[i][j]);
		}
		cout<<" ";
		for(int j=0;j<3;j++){
			printf("%c",o[i][j]);
		}
		printf("\n");
	}
}