結果
問題 |
No.954 Result
|
ユーザー |
![]() |
提出日時 | 2019-12-22 00:42:11 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 640 bytes |
コンパイル時間 | 1,958 ms |
コンパイル使用メモリ | 74,460 KB |
実行使用メモリ | 50,552 KB |
最終ジャッジ日時 | 2024-09-13 06:19:57 |
合計ジャッジ時間 | 5,121 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 WA * 1 |
other | AC * 25 WA * 4 |
ソースコード
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); long[] a = new long[5]; for (int i = 0; i < a.length; i++) { a[4 - i] = Long.parseLong(br.readLine()); } br.close(); long f1 = 0; long f2 = 1; int i = 0; int ans = 0; if (a[0] == 1) { ans++; i++; } while (i < 5) { long n = f1 + f2; if (n == a[i]) { ans++; i++; } else if (ans > 0 || n > a[i]) { break; } f1 = f2; f2 = n; } System.out.println(ans); } }