2052picture
来源:互联网 发布:python .如何使用 编辑:程序博客网 时间:2024/06/02 07:05
画矩形,我用的笨方法,这有三种符号和空格,分别用,0,1,2,3表示,用二维数组。
然后遍历 就画出来了。
import java.util.Scanner;
public class P2052 {
public static void main(String[] args) {
Scanner scanner =new Scanner(System.in);
while(scanner.hasNext()){
int width = scanner.nextInt();
int height = scanner.nextInt();
int wh [][] =new int [height+2][width+2];//行 列
for(int i=0;i
for(int j=0;j
wh[0][j]=1;
wh[height+1][j]=1;//1: -
wh[i][0]=2;
wh[i][width+1]=2;//2:| 其余为零 表示 空格
}
}
wh[0][0]=3;wh[0][width+1]=3;wh[height+1][0]=3;
wh[height+1][width+1]=3;//重新复制四个角
for(int i=0;i
for(int j=0;j
if(wh[i][j]==0){
System.out.print(" ");
}else if(wh[i][j]==1){
System.out.print("-");
}else if(wh[i][j]==2){
System.out.print("|");
}else{
System.out.print("+");
}
}
System.out.println();
}
System.out.println();
}
}
}
//+---+ +---+
//| | | |
//| | | |
//+---+ +---+
0 0
- 2052 Picture
- Picture 2052
- 2052 Picture
- [2052]:Picture
- 2052Picture
- 2052picture
- HDOJ 2052 Picture
- hdu 2052 picture
- Hdu 2052 - Picture
- HDU 2052 Picture
- HDU 2052 Picture
- HDU 2052 - Picture
- 杭电 2052 Picture
- 2052——Picture
- HDUJ 2052 Picture 模拟
- HDU 2052 Picture
- Picture hdoj 2052
- hdoj.2052 Picture 20140804
- 2037今年暑假不AC
- 2045不容易系列之(3)—— LELE…
- 错排算法
- 原创测试
- 2016年01月28日
- 2052picture
- iOS Swift _Nullable 与 Android 注解帮助编译时检查 - 两家好像步调开始一致一段时间了
- 2049不容易系列之(4)——考新郎
- stm32的两种固件下载模式:JTAG和SWD
- 2057A + B Again
- 2059龟兔赛跑
- 2060Snooker斯诺克
- java里面byte数组和String字符串怎么转换
- Maven executable 参数写法(Unrecognized option: -cp)