日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

poj 1102 LC-Display(模拟)

發布時間:2023/12/20 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 poj 1102 LC-Display(模拟) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

題目:http://poj.org/problem?id=1102

LC-Display
Time Limit:?1000MS?Memory Limit:?10000K
Total Submissions:?15752?Accepted:?6291

Description

A friend of you has just bought a new computer. Until now, the most powerful computer he ever used has been a pocket calculator. Now, looking at his new computer, he is a bit disappointed, because he liked the LC-display of his calculator so much. So you decide to write a program that displays numbers in an LC-display-like style on his computer.

Input

The input contains several lines, one for each number to be displayed. Each line contains two integers s, n (1 <= s <= 10, 0 <= n <= 99 999 999), where n is the number to be displayed and s is the size in which it shall be displayed.?

The input file will be terminated by a line containing two zeros. This line should not be processed.

Output

Output the numbers given in the input file in an LC-display-style using s "-" signs for the horizontal segments and s "|" signs for the vertical ones. Each digit occupies exactly s+2 columns and 2s+3 rows. (Be sure to fill all the white space occupied by the digits with blanks, also for the last digit.) There has to be exactly one column of blanks between two digits.?

Output a blank line after each number. (You will find a sample of each digit in the sample output.)

Sample Input

2 12345 3 67890 0 0

Sample Output

-- -- -- | | | | | | | | | | | | -- -- -- -- | | | | || | | | |-- -- -- --- --- --- --- --- | | | | | | | | | | | | | | | | | | | | | | | |--- --- --- | | | | | | | | | | | | | | | | | | | | | | | |--- --- --- --- 分析:是的,這就是一道模擬題,僅此而已。需要細心。我是先把8按照尺寸要求寫出來,然后其他數字再在8的基礎上抹去某些筆畫,再保存該數字。

解題時我干了一件用時間換空間的傻事,n<1e9的,頂多8位數,我神乎其神的誤認為保存結果的話需要1e9的數組空間,||-_- 是一維為9的空間!下面的代碼數組直接二維,沒有保存所有的數字信息,寫出一個數字print一部分,這時間浪費的啊。。還好過了。。
#include <iostream> #include <cstdio> #include <cstring> using namespace std; int s; char n[20],eight[35][20],str[35][20]; void printblank(){for(int i=0;i<2*s+3;i++) printf(" \n"); } void createight(){memset(eight,0,sizeof(eight));eight[0][0]=' '; for(int j=1;j<s+1;j++) eight[0][j]='-'; eight[0][s+1]=' ';for(int i=1;i<s+1;i++){eight[i][0]='|'; for(int j=1;j<s+1;j++) eight[i][j]=' '; eight[i][s+1]='|';}eight[s+1][0]=' '; for(int j=1;j<s+1;j++) eight[s+1][j]='-'; eight[s+1][s+1]=' ';for(int i=s+2;i<2*s+2;i++){eight[i][0]='|'; for(int j=1;j<s+1;j++) eight[i][j]=' '; eight[i][s+1]='|';}eight[2*s+2][0]=' '; for(int j=1;j<s+1;j++) eight[2*s+2][j]='-'; eight[2*s+2][s+1]=' '; } void clear(int p){if(p==1) for(int j=0;j<s+2;j++) str[0][j]=' ';else if(p==2) for(int i=1;i<s+1;i++) str[i][0]=' ';else if(p==3) for(int i=1;i<s+1;i++) str[i][s+1]=' ';else if(p==4) for(int j=0;j<s+2;j++) str[s+1][j]=' ';else if(p==5) for(int i=s+2;i<2*s+2;i++) str[i][0]=' ';else if(p==6) for(int i=s+2;i<2*s+2;i++) str[i][s+1]=' ';else if(p==7) for(int j=0;j<s+2;j++) str[2*s+2][j]=' '; } void copy(){for(int i=0;i<2*s+3;i++){for(int j=0;j<s+2;j++) str[i][j]=eight[i][j];} } void print(int x){copy();if(x==1){ clear(1); clear(2); clear(4); clear(5); clear(7); }else if(x==2){ clear(2); clear(6); }else if(x==3){ clear(2); clear(5); }else if(x==4){ clear(1); clear(5); clear(7); }else if(x==5){ clear(3); clear(5); }else if(x==6){ clear(3); }else if(x==7){ clear(2); clear(4); clear(5); clear(7); }else if(x==9){ clear(5); }else if(x==0){ clear(4); } } int main() {//freopen("cin.txt","r",stdin);while(cin>>s>>n){if(s==0&&n[0]=='0') break;createight();int length=strlen(n);int i,j,k;for(i=0;i<2*s+3;i++){for(k=0;k<length;k++){print(n[k]-'0');for(j=0;j<s+2;j++) printf("%c",str[i][j]);printf(" ");}puts("");}puts("");}return 0; }

總結

以上是生活随笔為你收集整理的poj 1102 LC-Display(模拟)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 日本毛片网站 | 国产精品久久久久久亚洲调教 | 亚洲aav| 亚洲а∨天堂久久精品2021 | 欧美日韩国产精品 | 成人污污视频 | 手机在线中文字幕 | 瑟瑟综合 | 日本护士体内she精2xxx | 一区二区精 | 色婷婷av一区二区三区四区 | 六月丁香啪啪 | 黑人巨大精品欧美黑寡妇 | 国产99re | 成人综合色站 | 欧美精品1 | 朴麦妮原版视频高清资源 | 久久天天东北熟女毛茸茸 | 久草视频免费在线 | 超碰www | 久久传媒| 中文字幕亚洲一区二区三区五十路 | 欧美性爱精品在线 | 国产av一区二区不卡 | 91麻豆成人精品国产 | 亚洲综合网址 | 日本一级吃奶淫片免费 | 成年人国产视频 | 伊人色综合网 | 特级西西www444人体聚色 | 色屁屁一区二区三区 | 激情四月 | 五月天婷婷丁香花 | 麻豆精品91 | 成人免费毛片男人用品 | 欧美电影一区二区三区 | 日韩av免费在线播放 | 国产淫片av片久久久久久 | 色综合久久中文字幕无码 | 91久久网 | 黄色av三级 | 一级国产特黄bbbbb | 国产精品v亚洲精品v日韩精品 | 国产第8页 | 欲乱美女 | 国产又粗又爽视频 | 久久久久久久久久久久久久国产 | 少妇av一区二区三区 | 亚洲成人18 | 国产精品视频亚洲 | 日韩精品一区二区亚洲av性色 | 亚洲一区在线观看视频 | 精品人妻无码一区二区性色 | 久久综合一区 | 兄弟兄弟全集免费观看 | 在线看你懂得 | 三上悠亚一区二区三区 | 激情五月婷婷小说 | 天堂资源在线播放 | 亚洲熟女综合色一区二区三区 | 日本国产精品一区 | jvid在线| 一区二区视频网 | 91黄色在线观看 | 黄色国产在线观看 | 91亚色视频 | 欧美日本一二三区 | 亚洲自拍偷拍一区 | 成人深夜小视频 | 高潮一区二区三区乱码 | 国产日韩欧美激情 | 国模大胆一区二区三区 | 日干夜干 | 免费黄色小视频网站 | 久久久久国产一区二区三区潘金莲 | 久久黄色免费视频 | 久久99精品久久久久久三级 | 91网站免费观看 | 国产视频在线播放 | 成人字幕 | 国产六区 | 成人精品黄段子 | 国产日韩精品视频 | 亚洲一区精品在线 | 伊人久久综合视频 | 秋霞欧美一区二区三区视频免费 | 成人国产一区 | 国产一区二区三区久久久 | 黄a大片| 国产老熟女一区二区三区 | 久久视频中文字幕 | 久久久久亚洲AV成人无在 | 极品少妇一区二区 | 精品国产一区二区三区久久久蜜臀 | 日本h在线观看 | 国产福利第一页 | 色一情一乱一区二区三区 | 色狠狠干 | 娇小萝被两个黑人用半米长 |