aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2021-04-18 21:31:06 -0500
committerGitHub2021-04-18 21:31:06 -0500
commit54129ba82f3235dc49c7329d7dab0387bcd02a50 (patch)
tree249d9effb1a6e0ca7622e3481b9329334e655a66
parent436e85c49b29c0de4979c55d6bef93daf2aaf6b8 (diff)
Create test.rs
-rw-r--r--test.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/test.rs b/test.rs
new file mode 100644
index 0000000..8e2c72a
--- /dev/null
+++ b/test.rs
@@ -0,0 +1,25 @@
+fn gcd(a : i32, b : i32) -> i32 {
+ if b > 0 {
+ return gcd(b, a % b);
+ } else {
+ return a;
+ }
+}
+
+fn main() {
+ println!("Hello World");
+
+ const N: i32 = 1000;
+ let mut A: [i32; N as usize] = [0; N as usize];
+ for i in 0..N {
+ A[i as usize] = i;
+ }
+
+ let mut ans = 0;
+ for i in &A {
+ for j in &A {
+ ans += gcd(*i, *j);
+ }
+ }
+ println!("{}", ans);
+}