Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/Set-right-adjacent-bits/Perl/set-right-adjacent-bits.pl
Normal file
21
Task/Set-right-adjacent-bits/Perl/set-right-adjacent-bits.pl
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
use feature 'bitwise';
|
||||
|
||||
while( <DATA> ) {
|
||||
my ($n, $input) = split;
|
||||
my $width = length $input;
|
||||
my $result = '';
|
||||
$result |.= substr 0 x $_ . $input, 0, $width for 0..$n;
|
||||
print "n = $n width = $width\n input $input\nresult $result\n\n";
|
||||
}
|
||||
|
||||
__DATA__
|
||||
2 1000
|
||||
2 0100
|
||||
2 0011
|
||||
2 0000
|
||||
0 010000000000100000000010000000010000000100000010000010000100010010
|
||||
1 010000000000100000000010000000010000000100000010000010000100010010
|
||||
2 010000000000100000000010000000010000000100000010000010000100010010
|
||||
3 010000000000100000000010000000010000000100000010000010000100010010
|
||||
Loading…
Add table
Add a link
Reference in a new issue