Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.73 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. $szam1=<>;
  4. chomp($szam1);
  5.  
  6. my @tomb;
  7.  
  8. for($i=0; $i<=$szam1; $i++)
  9. {
  10.         print "$i ";
  11.         push (@tomb, $i);
  12. }
  13.  
  14. print "\n";
  15.  
  16.  
  17. if($szam1 > 0)
  18. {
  19.         for($i=0; $i<=$szam1; $i++)
  20.         {
  21.                 if($i%2 == 0)
  22.                 {
  23.                         print "$i/";
  24.                 }
  25.         }
  26. }
  27. else
  28. {
  29.         print "0";
  30. }
  31.  
  32. for($i=0; $i<=$#tomb; $i++)
  33. {
  34.         if($i%2 == 1)
  35.         {
  36.                 if($tomb[$i] != $tomb[-1] && $tomb[$i] != $#tomb && $tomb[$i] != $tomb[-2])
  37.                 {
  38.                         print "$i/";
  39.                 }
  40.                 else
  41.                 {
  42.                         print "$i";
  43.                 }
  44.         }
  45. }
  46. print "\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement