結果

問題 No.557 点対称
ユーザー fal_rnd
提出日時 2017-08-11 23:35:49
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 806 bytes
コンパイル時間 2,560 ms
コンパイル使用メモリ 81,140 KB
実行使用メモリ 55,980 KB
最終ジャッジ日時 2024-10-12 22:04:27
合計ジャッジ時間 7,106 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 RE * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.stream.IntStream;

public class Main{
	static IntStream REPS(int v){return IntStream.range(0,v);}
	static IntStream REPS(int l,int r){return IntStream.rangeClosed(l,r);}
	static IntStream INS(int n) {return REPS(n).map(i->getInt());}
	static Scanner s=new Scanner(System.in);
	static int getInt(){return Integer.parseInt(s.next());}

	public static void main(String[]$){
		long n=getInt(),r=4,mod=1000000007;
		if(n==1) {
			System.out.println(2);
			return;
		}
		r=r*modPow(5,n/2-1,mod)%mod;
		if(n%2==1)
			r=r*3%mod;
		System.out.println(r);
	}
	public static long modPow(long n,long p,long mod) {
		if(p==0) return 1;
		if(p==1) return n%mod;
		if(p%2==0) {
			long buf=modPow(n, p/2, mod);
			return buf*buf%mod;
		}
		return n*modPow(n, p-1, mod)%mod;
	}
}
0