0128 - Abacus
#include <iostream> using namespace std; const string data[10]={ "* = ****", "* =* ***", "* =** **", "* =*** *", "* =**** ", " *= ****", " *=* ***", " *=** **", " *=*** *", " *=**** " }; void Slove(int number) { string answer[5]; for (int i=0; i<5; ++i) { answer[(5-1)-i]=data[number%10]; number/=10; } for (int j=0; j<8; ++j) { for (int i=0; i<5; ++i) cout << answer[i][j]; cout << endl; } } int main(void) { int number; bool flg = false; while (cin >> number) { (flg)? cout << endl : flg=true; Slove(number); } return 0; }
表を作って当てはめるだけ。