编写一个程序,求11111111111111*111111111111111的值,用数组的知识
1个回答
展开全部
my @map1 = qw(
.........OXXXX.........
.......XXXXXXXXXX......
.....XXXXX1111XXXX.....
....XXX1111111111XX....
...XX111111111111XXO...
...XX1111111111111XX...
..XX111111111111111XXO.
..XX1111111111111111XX.
.XX11111111111111111XX.
.XX11111111111111111XX.
.XX11111111111111111XXO
.XX11111111111111111XXO
.XX11111111111111111XXO
.XX11111111111111111XX.
.OXX1111111111111111XX.
..XX1111111111111111XX.
...XX11111111111111XX..
....XX111111111111XXO..
....XX111111111111XX...
.....XXX1111111XXXX....
......XXXXXXXXXXXO.....
........XXXXXXXO.......
.......................);
@map1 = map {[split //]} @map1;
my @map2 = qw(
.........XXXXX.........
.......X111X1XX1X......
.....X1111X111X11X.....
....XX1X1111111111X....
...X1X11111111X1111X...
...1XX1XX11X1X111111...
..X1X1111X1111111111XX.
..11X11XXXX11X1111111X.
.XXX1111X1111X1X11111X.
.X11111X1111111X111111.
.XXX111111X11111111111X
.XX11X1111111X1X111111X
.X11111X1111X111111111X
.X11111XX1111111X1X11X.
.XX1X111X11X111X11X11X.
..X1X111111X1X1X1XX11X.
...11111111111111XX11..
....1X111X11X11111XXX..
....X1XX1111X1111XXX...
.....XX1111111XX11X....
......X11XXX11XX1X.....
........11XXX1XX.......
.......................);
@map2 = map {[split //]} @map2;
for my $m (0 .. $#map2) {
for my $n (0 .. $#{$map2[$m]}) {
if ($map2[$m][$n] =~ /X|O/ or $map1[$m][$n] =~ /X|O/) {
print 'X';
} else {
print '1';
}
}
print "\n";
}
.........OXXXX.........
.......XXXXXXXXXX......
.....XXXXX1111XXXX.....
....XXX1111111111XX....
...XX111111111111XXO...
...XX1111111111111XX...
..XX111111111111111XXO.
..XX1111111111111111XX.
.XX11111111111111111XX.
.XX11111111111111111XX.
.XX11111111111111111XXO
.XX11111111111111111XXO
.XX11111111111111111XXO
.XX11111111111111111XX.
.OXX1111111111111111XX.
..XX1111111111111111XX.
...XX11111111111111XX..
....XX111111111111XXO..
....XX111111111111XX...
.....XXX1111111XXXX....
......XXXXXXXXXXXO.....
........XXXXXXXO.......
.......................);
@map1 = map {[split //]} @map1;
my @map2 = qw(
.........XXXXX.........
.......X111X1XX1X......
.....X1111X111X11X.....
....XX1X1111111111X....
...X1X11111111X1111X...
...1XX1XX11X1X111111...
..X1X1111X1111111111XX.
..11X11XXXX11X1111111X.
.XXX1111X1111X1X11111X.
.X11111X1111111X111111.
.XXX111111X11111111111X
.XX11X1111111X1X111111X
.X11111X1111X111111111X
.X11111XX1111111X1X11X.
.XX1X111X11X111X11X11X.
..X1X111111X1X1X1XX11X.
...11111111111111XX11..
....1X111X11X11111XXX..
....X1XX1111X1111XXX...
.....XX1111111XX11X....
......X11XXX11XX1X.....
........11XXX1XX.......
.......................);
@map2 = map {[split //]} @map2;
for my $m (0 .. $#map2) {
for my $n (0 .. $#{$map2[$m]}) {
if ($map2[$m][$n] =~ /X|O/ or $map1[$m][$n] =~ /X|O/) {
print 'X';
} else {
print '1';
}
}
print "\n";
}
追问
看不懂怎么办啊?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询