Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $s = <STDIN>;
- my ($N, $K, @arr);
- ($N, $K) = split /\s/, $s;
- $s = <STDIN>;
- @arr = split /\s/, $s;
- my %hash;
- my $cnt = 0;
- my %intersectlist;
- foreach my $k(@arr) {
- $intersectlist{$k + $K} = 1;
- }
- for my $k(@arr) {
- $cnt++ if exists $intersectlist{$k};
- }
- print $cnt;
Advertisement
Add Comment
Please, Sign In to add comment