Submission
Status:
PPPPPPPPPPPPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: yippie
Problemset: Abacus
Language: cpp
Time: 0.003 second
Submitted On: 2025-11-09 19:44:03
#include<iostream>
using namespace std;
int main(){
int num,n[9];
string abacus[10][15];
cin >> num;
for (int i=0; i<10; i++){
for (int j=0; j<8; j++){
if (i<2 || i>4){
abacus[i][j] = "*";
} else if (i == 2 || i == 4){
abacus[i][j] = " ";
}
}
}
int x=0;
while (num > 0){
n[x] = num%10;
num /= 10;
x++;
}
for (int y=0; y<x; y++){
if (n[y] >= 5){
abacus[1][7-y] = " ";
abacus[2][7-y] = "*";
n[y] -= 5;
}
int z = 4;
if (n[y] < 5 && n[y] != 0){
while (n[y] > 0){
abacus[z][7-y] = "*";
abacus[z+1][7-y] = " ";
n[y] -= 1;
z++;
}
}
}
for (int i=0; i<10; i++){
for (int j=0; j<15; j++){
if (i == 3) {
cout << "-----------------";
break;
}
else cout << abacus[i][j] << " ";
}
cout << endl;
}
return 0;
}