Submission

Status:

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

Subtask/Task Score:

0/100

Score: 0

User: octoberhail

Problemset: Abacus

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-13 21:16:41

//
// Created by Nattawat on 10/12/2026.
//
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;

    vector<int> num;
    int divide = 10;
    while (n != 0) {
        int remain = n % 10;
        num.push_back(remain);
        n/=10;
    }

    for (int i = 0; i < 8; i++) {
        cout << "* ";
    }
    cout << '\n' << '\n';
    vector<int> cpy = num;
    vector<int> shift(9., 0);
    while (!cpy.empty()) {
        int number = cpy.back();
        if (number % 5 == 0 && number != 0) {
            shift[cpy.size()]= 1;
        }
        cpy.pop_back();
    }

    for (int i = 8; i >= 1; i--) {
        if (shift[i] == 0) {
            cout << "* ";
        }else {
            cout << "  ";
        }
    }
    cout << '\n' << '\n';
    for (int i = 8; i >= 1; i--) {
        if (shift[i] == 1) {
            cout << "* ";
        }else {
            cout << "  ";
        }
    }
    cout << '\n' << '\n';
    for (int i = 0; i < 17; i++) cout << '-';
    cout << '\n' << '\n';
    int skip[8 + 1] = {0};
    for (int i = 8; i >= 1; i--) {
        if (i > num.size()) {
            cout << "  ";
        }else {
            int re = ((num[i - 1] - 5 + 5) % 5);
            if (re != 0) {
                skip[i] = re;
                cout << "* ";
            }else {
                cout <<  "  ";
            }
        }
    };
    for (int i = 1; i <= 5; i++ ) {
        cout << '\n' << '\n';
        for (int j = 8; j >= 1; j--) {
            if (j > num.size()) {
                cout << "* ";

            }else {
                if (skip[j] == i) {
                    cout << "  ";
                }else {
                    cout << "* ";
                }

            }
        }
    }
}