結果
問題 |
No.954 Result
|
ユーザー |
![]() |
提出日時 | 2019-12-17 11:08:31 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 848 bytes |
コンパイル時間 | 14,934 ms |
コンパイル使用メモリ | 235,736 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-04 12:36:01 |
合計ジャッジ時間 | 14,934 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 7 |
other | AC * 29 |
ソースコード
package main import ( "bufio" "fmt" "math" "os" "strconv" ) func main() { a := make([]int, 5) for i := 4; i >= 0; i-- { a[i] = readInt() } ans := make([]int, 0) for fib1, fib2 := 1, 1; fib1 <= a[0]; fib1, fib2 = fib2, fib1+fib2 { if a[0] == fib1 { c := 0 x := fib1 y := fib2 for j := 0; j < len(a); j++ { if a[j] == x { c++ x, y = y, x+y } else { break } } ans = append(ans, c) } } max := 0 for _, v := range ans { if max < v { max = v } } fmt.Println(max) } var stdin *bufio.Scanner func read() string { if stdin == nil { stdin = bufio.NewScanner(os.Stdin) stdin.Split(bufio.ScanWords) stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), int(math.MaxInt32)) } stdin.Scan() return stdin.Text() } func readInt() int { n, _ := strconv.Atoi(read()) return n }