Submission

Status:

--------------------

Subtask/Task Score:

0/100

Score: 0

User: Miter

Problemset: Abacus

Language: cpp

Time: 0.006 second

Submitted On: 2026-10-05 21:56:00

#include <iostream>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int num;
    int number[8] = {0, 0, 0, 0, 0, 0, 0, 0};
    cin >> num;

    char top_table[2][8] = {{'*', '*', '*', '*', '*', '*', '*', '*'}, {'*', '*', '*', '*', '*', '*', '*', '*'}};
    char mid_table[2][8] = {{' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '}};
    char button_table[5][8] = {{'*', '*', '*', '*', '*', '*', '*', '*'}, {'*', '*', '*', '*', '*', '*', '*', '*'}, {'*', '*', '*', '*', '*', '*', '*', '*'}, {'*', '*', '*', '*', '*', '*', '*', '*'}, {'*', '*', '*', '*', '*', '*', '*', '*'}};

    for (int i = 7; i > 0; i--)
    {
        number[i] = num % 10;
        num -= num % 10;
        num /= 10;
    }
    

    for (int i = 0; i < 8; i++)
    {
        cout << number[i] << "\n";
        short top_m = number[i] / 5;
        short button_m = number[i] % 5;
        if(top_m > 0){
            mid_table[0][i] = '*';
            top_table[top_m][i] = ' ';
        }
        
        if(button_m > 0){
            mid_table[1][i] = '*';
            button_table[button_m - 1][i] = ' ';
        }
    }

    for (int i = 0; i < 2; i++)
    {
        for (int j = 0; j < 8; j++)
        {
            cout << top_table[i][j] << " ";
        }
        cout << "\n";
    }
    for (int i = 0; i < 2; i++)
    {
        for (int j = 0; j < 8; j++)
        {
            cout << mid_table[i][j] << " ";
        }
        if (i == 0)
            cout << "\n---------------\n";
        else
            cout << "\n";
    }
    for (int i = 0; i < 5; i++)
    {
        for (int j = 0; j < 8; j++)
        {
            cout << button_table[i][j] << " ";
        }
        cout << "\n";
    }

    return 0;
}