summaryrefslogtreecommitdiffstats
path: root/PROB.pl
diff options
context:
space:
mode:
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;
+}