Advertisement
Guest User

c00k0ff

a guest
Oct 7th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 6 1.08 KB | None | 0 0
  1. #!/usr/bin/env perl6
  2.  
  3. sub checkIt() {
  4.     my $problems           = $*IN.get().Int;
  5.     my $cakewalk           = 0;
  6.     my $simple             = 0;
  7.     my $easy               = 0;
  8.     my $easy-medium-medium = 0;
  9.     my $medium-hard-hard   = 0;
  10.     loop (my $i = 0; $i < $problems; $i++) {
  11.         given $*IN.get() {
  12.             when 'cakewalk'    {$cakewalk++}
  13.             when 'simple'      {$simple++}
  14.             when 'easy'        {$easy++}
  15.             when 'easy-medium' {$easy-medium-medium++}
  16.             when 'medium'      {$easy-medium-medium++}
  17.             when 'medium-hard' {$medium-hard-hard++}
  18.             when 'hard'        {$medium-hard-hard++}
  19.         }
  20.     }
  21.     if $cakewalk           == 1 &&
  22.        $simple             == 1 &&
  23.        $easy               == 1 &&
  24.        $easy-medium-medium == 1 &&
  25.        $medium-hard-hard   == 1 {return "Yes"}
  26.     else {return "No"}
  27. }
  28.  
  29. sub MAIN(*@args) {
  30.     my $tests = $*IN.get().Int;
  31.     my @results;
  32.     loop (my $i = 0; $i < $tests; $i++) {
  33.         @results.push(checkIt())
  34.     }
  35.     for @results {say $_}
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement