SRM 162 Div2 Easy
あらかじめ用意しておいたGCDが正常に動かなかったため作り直してしまい時間がかかってしまった。
ライブラリが正常に動くかのチェックはちゃんとしないとだめだね。
得点:237.86/250
実装(VB.NET)
Imports Microsoft.VisualBasic Imports System Imports System.Collections Imports System.Collections.Generic Imports System.Text Imports System.Math Imports Weight = System.Int32 Public Class LCMRange Public Shared Function Gcd(ByVal a As Long, ByVal b As Long) As Long If (b > 0) Then Gcd = Gcd(b, a Mod b) Else Gcd = a End Function Public Shared Function Lcm_(ByVal a As Long, ByVal b As Long) As Long Return a / gcd(a, b) * b End Function Public Function lcm(ByVal first As Integer, ByVal last As Integer) As Integer Dim i As Long, j As Long Lcm = 1 For i = first To Last Lcm = CType(Lcm_(CType(Lcm, Long), i), Integer) Next i End Function End Class