Submission

Status:
xxxxxxxxxxxxxxxxxxxx

Score: 0

User: KhunKK9722

Problemset: Abacus

Language: cpp

Time: 0.003 second

Submitted On: 2025-03-08 16:14:59

using namespace std;
#include <iostream>
string arr[8][7]={"*","*","*","*","*","*","*","*",
                  "*","*","*","*","*","*","*","*",
                  "*","*","*","*","*","*","*","*",
                  "*","*","*","*","*","*","*","*",
                  "*","*","*","*","*","*","*","*",
                  "*","*","*","*","*","*","*","*",
                  "*","*","*","*","*","*","*","*"};
int type(int n,int v,int pos){
    int x = (n-(n%v))/v;
    if (x>=5){
        arr[pos][0]=" ";
    }
    else {
        arr[pos][1]=" ";
        arr[pos][(x%5)+2]=" ";
    }
    return 0;
}
int main()
{
    for(int x = 0; x < 8; x++)for(int y = 0; y < 7; y++){
        cout<<arr[x][y];
        if(x==8) cout<<"\n";
        if(y==2) cout<<"--------";
    } 
    cout<<"********";
    string c;
    // cin>>c;
    int n = stoi(c);
    // cout<<n;
    cout<<"********";
    if(n>=10000000)
    {
        type(n,100000000,0);
    }
    else if(n>=1000000)
    {
        type(n%100000000,10000000,1);
    }
    else if(n>=1000000)
    {
        type(n%10000000,1000000,2);
    }
    else if(n>=100000)
    {
        type(n%1000000,100000,3);
    }
    else if (n>=10000)
    {
        type(n%100000,10000,4);
    }
    else if (n>=1000)
    {
        type(n%10000,1000,5);
    }
    else if (n>=100)
    {
        type(n%1000,100,6);
    }
    else if (n>=10)
    {
        type(n%100,10,7);
    }
    else
    {
        type(n%10,1,8);
    }   
    for(int x = 0; x < 8; x++)for(int y = 0; y < 7; y++){
        cout<<arr[x][y];
        if(x==8) cout<<"\n";
        if(y==2) cout<<"--------";
    } 
    cout<<"********";
}