diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-10-20 14:15:41 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-10-20 14:15:41 -0500 |
commit | 10b6e814cf73a972c12a2e991cfd4935f34dc57c (patch) | |
tree | 50dfa514bfa279f024c85e0663243ef66d0a1b4b /PROB.pl | |
parent | bf7256e844ed6408b848f4f5f4cb9925282b9c6e (diff) | |
download | rosalind-10b6e814cf73a972c12a2e991cfd4935f34dc57c.tar.gz rosalind-10b6e814cf73a972c12a2e991cfd4935f34dc57c.zip |
another solution
Diffstat (limited to 'PROB.pl')
-rw-r--r-- | PROB.pl | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -0,0 +1,14 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use 5.016; + +my $first = 1; +for my $prob (split ' ', scalar <>) { + my $gc_prob = $prob / 2; + my $at_prob = (1 - $prob) / 2; + my $same_prob = ($gc_prob ** 2) * 2 + ($at_prob ** 2) * 2; + print $first ? '' : ' '; + print $same_prob; + $first = 0; +} |