結果

問題 No.356 円周上を回る3つの動点の一致
ユーザー yukirin
提出日時 2016-04-03 14:04:01
言語 Go
(1.23.4)
結果
WA  
実行時間 -
コード長 822 bytes
コンパイル時間 12,525 ms
コンパイル使用メモリ 233,128 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-10 23:53:16
合計ジャッジ時間 14,103 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other WA * 48
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	t1, t2, t3 := nextInt64(), nextInt64(), nextInt64()

	m := lcm(lcm(t1*t2, t1*t3), lcm(t2-t1, t3-t1))
	r := big.NewRat(t1*t2*m, m*(t2-t1))
	fmt.Println(r)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextLine())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextLine(), 10, 64)
	return i
}

func nextUint64() uint64 {
	i, _ := strconv.ParseUint(nextLine(), 10, 64)
	return i
}

func nextFloat() float64 {
	f, _ := strconv.ParseFloat(nextLine(), 64)
	return f
}

func gcd(a, b int64) int64 {
	for ; b != 0; b, a = a%b, b {
	}
	return a
}

func lcm(a, b int64) int64 {
	return (a * b) / gcd(a, b)
}
0