結果
問題 | No.314 ケンケンパ |
ユーザー |
![]() |
提出日時 | 2017-09-19 12:03:49 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 632 bytes |
コンパイル時間 | 3,943 ms |
コンパイル使用メモリ | 75,052 KB |
実行使用メモリ | 41,584 KB |
最終ジャッジ日時 | 2024-11-08 05:32:07 |
合計ジャッジ時間 | 7,037 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 2 |
ソースコード
import java.util.Scanner;public class N314{static int cnt=0;static int n;public static void main(String[] args){Scanner sc=new Scanner(System.in);n=sc.nextInt();int length=2;int[] state=new int[3];int[] buf=new int[3];int beki=(int)Math.pow(10, 9)+7;state[0]=1;state[1]=1;state[2]=0;if(n>2){while(length!=n){for(int i=0;i<3;i++){buf[i]=state[i];}state[0]=buf[2]%beki;state[1]=(buf[0]+buf[2])%beki;state[2]=buf[1]%beki;length++;}for(int i=0;i<3;i++){cnt+=state[i];}}else{cnt=n;}System.out.println(cnt%beki);}}