Search
Write a publication
Pull to refresh
0
0

User

Send message
А я вот на c++ с ходу не осилил :(
#!/usr/bin/env perl

use strict;
use threads;
use Time::HiRes qw( usleep );

sub out_tomorrow{
  my ($delay,$str)=@_;
  usleep($delay*50000);
  print $str;
  threads->detach();
}

for( my ($i,$c3,$c5)=(1,2,4); $i<=100; $i++, $c3--, $c5-- ){
  my $s = ( ( (!$c3) || (!$c5) ) ? '' : $i ) .
          ( $c3 ? '' : ($c3=3,"Fizz") ) .
          ( $c5 ? '' : ($c5=5,"Buzz") ) .
          "\n" ;
  threads->create( {'void' => 1}, \&out_tomorrow, $i, $s );
}
while( threads->list(threads::running) ){};

Information

Rating
Does not participate
Location
Москва, Москва и Московская обл., Россия
Date of birth
Registered
Activity