From 10b6e814cf73a972c12a2e991cfd4935f34dc57c Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 20 Oct 2012 14:15:41 -0500 Subject: another solution --- PROB.pl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 PROB.pl (limited to 'PROB.pl') 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; +} -- cgit v1.2.3-54-g00ecf