結果

問題 No.554 recurrence formula
ユーザー fjafjafja
提出日時 2017-08-22 22:11:31
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 492 bytes
コンパイル時間 2,997 ms
コンパイル使用メモリ 74,524 KB
実行使用メモリ 54,280 KB
最終ジャッジ日時 2024-10-15 04:26:54
合計ジャッジ時間 6,363 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class N554
{
	public static void main(String[] args)
	{
		long e=0;//evennumber
		long o=1;//oddnumber
		int p=1;
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		long ans=0;
		if(n==1)
		{
			ans=1;
		}
		else
		{
			do
			{
				ans=0;
				p++;
				if(p%2==0)
				{
					ans=p*o;
					e+=ans;
				}
				else
				{
					ans=p*e;
					o+=ans;
				}
			}while(p!=n);
		}
		System.out.println(ans%(int)(Math.pow(10, 7)+7));
	}
}
0