UVA 706 LC-Display
来源:互联网 发布:淘宝93sport是正品吗 编辑:程序博客网 时间:2024/04/23 19:43
WA了好几发才发现9下面少了一横,OMG!!!
一个简单的模拟,细心就能过
#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>#include <cmath>#include <vector>using namespace std;int N,M;int a[200],cnt;char str[100];void heng_1(){for(int i = cnt-1; i >= 0; i--){if(i != cnt-1)printf(" ");printf(" ");if(a[i] == 1 || a[i] == 4){for(int j = 0; j < N; j++)printf(" ");}else{for(int j = 0; j < N; j++)printf("-");}printf(" ");}}void heng_2(){for(int i = cnt-1; i >= 0; i--){if(i != cnt-1)printf(" ");printf(" ");if(a[i] == 0 || a[i] == 1 || a[i] == 7){for(int j = 0; j < N; j++)printf(" ");}else{for(int j = 0; j < N; j++)printf("-");}printf(" ");}}void heng_3(){for(int i = cnt-1; i >= 0; i--){if(i != cnt-1)printf(" ");printf(" ");if(a[i] == 1 || a[i] == 4 || a[i] == 7){for(int j = 0; j < N; j++)printf(" ");}else{for(int j = 0; j < N; j++)printf("-");}printf(" ");}}void shu_1(){for(int i = cnt-1; i >= 0; i--){if(i != cnt-1)printf(" ");if(a[i] == 0 || a[i] == 4 || a[i] == 8 || a[i] == 9){printf("|");for(int j = 0; j < N; j++)printf(" ");printf("|");}else if(a[i] == 5 || a[i] == 6){printf("|");for(int j = 0; j < N; j++)printf(" ");printf(" ");}else{printf(" ");for(int j = 0; j < N; j++)printf(" ");printf("|");}}}void shu_2(){for(int i = cnt-1; i >= 0; i--){if(i != cnt-1)printf(" ");if(a[i] == 0 || a[i] == 6 || a[i] == 8){printf("|");for(int j = 0; j < N; j++)printf(" ");printf("|");}else if(a[i] == 2){printf("|");for(int j = 0; j < N; j++)printf(" ");printf(" ");}else{printf(" ");for(int j = 0; j < N; j++)printf(" ");printf("|");}}}int main(){while(~scanf("%d %s",&N,str) && N){cnt = 0;for(int i = strlen(str)-1; i >= 0 ; i--){a[cnt++] = str[i]-'0';}heng_1();puts("");for(int i = 0; i < N; i++){shu_1();puts("");}heng_2();puts("");for(int i = 0; i < N; i++){shu_2();puts("");}heng_3();puts("");puts("");}return 0;}
阅读全文
0 0
- uva 706 LC-Display
- UVa 706 LC-Display
- uva 706 LC-Display
- UVA 706 LC-Display
- 模拟 UVa 706 LC-Display
- UVa Problem Solution: 706 - LC-Display
- UVa Problem 706 LC-Display (液晶显示屏)
- PC/UVa 110104/706 LC-Display
- UVa Problem 706 LC-Display (液晶显示屏)
- UVa 706 Problem: LC-Display (PC 110104)
- 706 - LC-Display
- LC-Display
- LC-Display
- LC-Display
- LC-Display
- LC-Display
- LC-Display
- LC-Display
- SMTP协议分析
- Java菜鸟成长之路__Day_4_Java_内部类
- 20170719_蓝牙知识点总结
- MATLAB GUI新建、另存问题(GUIDE无法使用)
- git拉取远程分支并创建本地分支和Git中从远程的分支获取最新的版本到本地
- UVA 706 LC-Display
- ReactiveCocoa, RXSwift 速查表
- laravel ajax 500错误解决方法
- 判断当前日期是今年的第几天
- [bigata-113] python3连接到mongo 3.2副本集
- Sqlite创建database的两种方法,以及源码分析,以及抽象类如何在SqliteHelper中应用
- QT之QThread多线程编程
- 百度地图api将可视区域定位到当前所在位置
- Dubbo初窥