結果
| 問題 | No.141 魔法少女コバ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-02-27 19:24:43 |
| 言語 | Go (1.26.1) |
| 結果 |
AC
|
| 実行時間 | 1,578 ms / 5,000 ms |
| コード長 | 485 bytes |
| 記録 | |
| コンパイル時間 | 13,090 ms |
| コンパイル使用メモリ | 273,808 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-27 03:54:21 |
| 合計ジャッジ時間 | 23,827 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 93 |
ソースコード
package main
import (
"bufio"
"fmt"
"math/big"
"os"
"strconv"
)
var sc = bufio.NewScanner(os.Stdin)
func main() {
sc.Split(bufio.ScanWords)
r := big.NewRat(nextInt64(), nextInt64())
m, n := r.Num().Int64(), r.Denom().Int64()
c := 0
for n != 1 || m != 1 {
if m < n {
m, n = n, m
c++
}
m -= n
c++
}
fmt.Println(c)
}
func nextLine() string {
sc.Scan()
return sc.Text()
}
func nextInt64() int64 {
i, _ := strconv.ParseInt(nextLine(), 10, 64)
return i
}