aboutsummaryrefslogtreecommitdiff
path: root/test.pl
diff options
context:
space:
mode:
authorAnthony Wang2020-09-10 16:23:36 -0500
committerAnthony Wang2020-09-10 16:23:36 -0500
commit22e061794c8f163c8d4777a13c30f42d0122a262 (patch)
tree6424b8efda5bddf88c12c2befeeb90ddab370489 /test.pl
parentbb6415b40f7d5a29361fa2a8568eabf8edab947b (diff)
Add test.pl
Diffstat (limited to 'test.pl')
-rw-r--r--test.pl19
1 files changed, 19 insertions, 0 deletions
diff --git a/test.pl b/test.pl
new file mode 100644
index 0000000..565c052
--- /dev/null
+++ b/test.pl
@@ -0,0 +1,19 @@
+# Perl
+
+sub gcd {
+ if ($_[1] > 0) { return gcd($_[1], $_[0] % $_[1]); }
+ else { return $_[0]; }
+}
+
+print("test\n");
+
+$N = 1000;
+@A = (0..$N-1);
+
+$ans = 0;
+for my $i (@A) {
+ for my $j (@A) {
+ $ans += gcd($i, $j);
+ }
+}
+print($ans);