結果
問題 | No.141 魔法少女コバ |
ユーザー |
|
提出日時 | 2016-02-27 19:24:43 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 1,611 ms / 5,000 ms |
コード長 | 485 bytes |
コンパイル時間 | 12,358 ms |
コンパイル使用メモリ | 235,548 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-10 23:02:37 |
合計ジャッジ時間 | 22,592 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 93 |
ソースコード
package mainimport ("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 := 0for n != 1 || m != 1 {if m < n {m, n = n, mc++}m -= nc++}fmt.Println(c)}func nextLine() string {sc.Scan()return sc.Text()}func nextInt64() int64 {i, _ := strconv.ParseInt(nextLine(), 10, 64)return i}