diff options
author | Anthony Wang | 2020-09-14 10:17:03 -0500 |
---|---|---|
committer | Anthony Wang | 2020-09-14 10:17:03 -0500 |
commit | 0de670f3247bb7a465485131711d4cd4fe00d7c0 (patch) | |
tree | ec90898517ed4343a11155121469c0ff96b84a78 /test.php | |
parent | 159c04404b7ee9609fdca63593983b454b13e649 (diff) |
Add test.php
Diffstat (limited to 'test.php')
-rw-r--r-- | test.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test.php b/test.php new file mode 100644 index 0000000..9ba6cd5 --- /dev/null +++ b/test.php @@ -0,0 +1,23 @@ +<?php +// PHP + +function gcd(int $a, int $b) { + if ($b > 0) return gcd($b, $a % $b); + else return $a; +} + +echo "test\n"; + +const N = 1000; +$A = array(); +for ($i = 0; $i < N; $i++) { + $A[$i] = $i; +} + +$ans = 0; +foreach ($A as $i) { + foreach ($A as $j) { + $ans += gcd($i, $j); + } +} +echo $ans; |