finished hw7

This commit is contained in:
2019-11-18 16:34:57 -07:00
parent f47f079bdc
commit 336746c138
514 changed files with 38393 additions and 2 deletions

17
untitled4/main.cpp Normal file
View File

@@ -0,0 +1,17 @@
object Solution {
import scala.collection.mutable
def gcd(bunny1: Long, bunny2: Long): Long = {
if(bunny2 == 0) bunny1 else gcd(bunny2, bunny1 % bunny2)
}
def main(args: Array[String]) {
val n = readLine()
val bunnies = readLine().split(' ').map(_.toLong)
val tmp = mutable.ArrayBuffer[Long](1)
for (i <- 0 until bunnies.length) {
tmp(0) = tmp(0) / gcd(arr(0), bunnies(i)) * bunnies(i)
}
println(tmp(0))
}
}