summaryrefslogtreecommitdiffstats
path: root/PROB.pl
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-10-20 14:15:41 -0500
committerJesse Luehrs <doy@tozt.net>2012-10-20 14:15:41 -0500
commit10b6e814cf73a972c12a2e991cfd4935f34dc57c (patch)
tree50dfa514bfa279f024c85e0663243ef66d0a1b4b /PROB.pl
parentbf7256e844ed6408b848f4f5f4cb9925282b9c6e (diff)
downloadrosalind-10b6e814cf73a972c12a2e991cfd4935f34dc57c.tar.gz
rosalind-10b6e814cf73a972c12a2e991cfd4935f34dc57c.zip
another solution
Diffstat (limited to 'PROB.pl')
-rw-r--r--PROB.pl14
1 files changed, 14 insertions, 0 deletions
diff --git a/PROB.pl b/PROB.pl
new file mode 100644
index 0000000..bccb219
--- /dev/null
+++ b/PROB.pl
@@ -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;
+}