-
#include <iostream>
-
#include <string>
-
-
std::string NumberList;
-
-
unsigned char CharacterTable[ 10 ][ 5 ][ 3 ] = { { { ' ', '-', ' ' }, { '|', ' ', '|' }, { ' ', ' ', ' ' }, { '|', ' ', '|' }, { ' ', '-', ' ' } }, // 0
-
{ { ' ', ' ', ' ' }, { ' ', ' ', '|' }, { ' ', ' ', ' ' }, { ' ', ' ', '|' }, { ' ', ' ', ' ' } }, // 1
-
{ { ' ', '-', ' ' }, { ' ', ' ', '|' }, { ' ', '-', ' ' }, { '|', ' ', ' ' }, { ' ', '-', ' ' } }, // 2
-
{ { ' ', '-', ' ' }, { ' ', ' ', '|' }, { ' ', '-', ' ' }, { ' ', ' ', '|' }, { ' ', '-', ' ' } }, // 3
-
{ { ' ', ' ', ' ' }, { '|', ' ', '|' }, { ' ', '-', ' ' }, { ' ', ' ', '|' }, { ' ', ' ', ' ' } }, // 4
-
{ { ' ', '-', ' ' }, { '|', ' ', ' ' }, { ' ', '-', ' ' }, { ' ', ' ', '|' }, { ' ', '-', ' ' } }, // 5
-
{ { ' ', '-', ' ' }, { '|', ' ', ' ' }, { ' ', '-', ' ' }, { '|', ' ', '|' }, { ' ', '-', ' ' } }, // 6
-
{ { ' ', '-', ' ' }, { ' ', ' ', '|' }, { ' ', ' ', ' ' }, { ' ', ' ', '|' }, { ' ', ' ', ' ' } }, // 7
-
{ { ' ', '-', ' ' }, { '|', ' ', '|' }, { ' ', '-', ' ' }, { '|', ' ', '|' }, { ' ', '-', ' ' } }, // 8
-
{ { ' ', '-', ' ' }, { '|', ' ', '|' }, { ' ', '-', ' ' }, { ' ', ' ', '|' }, { ' ', '-', ' ' } } }; // 9
-
-
void HorizonalPrint( int Width, int Seq )
-
{
-
bool IsFirst = true;
-
char PrintChar;
-
size_t VectorCount = NumberList.length();
-
-
for( unsigned int i = 0; i < VectorCount; ++i ) {
-
-
PrintChar = CharacterTable[ NumberList[ i ] - '0' ][ Seq ][ 1 ];
-
-
if( i != 0 )
-
std::cout << " ";
-
-
std::cout << " ";
-
for( int j = 0; j < Width; ++j ) {
-
std::cout << PrintChar;
-
}
-
std::cout << " ";
-
}
-
}
-
-
void VerticalPrint( int Width, int Seq )
-
{
-
bool IsFirst = true;
-
size_t VectorCount = NumberList.length();
-
-
std::string PrintStr = "";
-
-
for( unsigned int i = 0; i < VectorCount; ++i ) {
-
-
if( i != 0 )
-
PrintStr += " ";
-
-
PrintStr += CharacterTable[ NumberList[ i ] - '0' ][ Seq ][ 0 ];
-
for( int j = 0; j < Width; ++j ) {
-
PrintStr += " ";
-
}
-
PrintStr += CharacterTable[ NumberList[ i ] - '0' ][ Seq ][ 2 ];
-
}
-
-
for( int Cnt = 0; Cnt < Width; ++Cnt )
-
std::cout << PrintStr.c_str() << std::endl;
-
}
-
-
void PrintNumber( int Width )
-
{
-
for( int i = 0; i < 5; ++i ) {
-
-
if( i & 1 )
-
VerticalPrint( Width, i );
-
else {
-
HorizonalPrint( Width, i );
-
std::cout << std::endl;
-
}
-
}
-
}
-
-
int main( int argc, char **argv )
-
{
-
int CharacterWidth;
-
-
while( true ) {
-
-
std::cin >> CharacterWidth >> NumberList;
-
-
if( CharacterWidth == 0 ) {
-
-
if( NumberList == "0" )
-
break;
-
else
-
continue;
-
}
-
-
PrintNumber( CharacterWidth );
-
}
-
-
return 0;
-
}
-
-
댓글을 달아 주세요
그냥 using namespace std 쓰시지 ...
큰 작업도 아니고 uva 문제 푸는 정도면
유도리 있게 코딩하시는거도 좋다고 생각합니다.
아 ㅋㅋ 물론 진짜 ACM 대회를 나가게 된다면 시간이 중요하니 그럴수 있겠지만.. 평상시 일 때는 원칙을 되도록 지키고 싶어서 그렇습니다^^.