結果

問題 No.557 点対称
ユーザー fal_rndfal_rnd
提出日時 2017-08-11 23:37:28
言語 Java19
(openjdk 21)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 810 bytes
コンパイル時間 2,096 ms
コンパイル使用メモリ 78,236 KB
実行使用メモリ 56,316 KB
最終ジャッジ日時 2023-08-02 23:56:24
合計ジャッジ時間 7,521 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
56,028 KB
testcase_01 AC 117 ms
56,080 KB
testcase_02 AC 117 ms
55,760 KB
testcase_03 AC 117 ms
56,028 KB
testcase_04 AC 116 ms
56,316 KB
testcase_05 AC 117 ms
55,808 KB
testcase_06 AC 117 ms
56,248 KB
testcase_07 AC 115 ms
55,908 KB
testcase_08 AC 117 ms
55,748 KB
testcase_09 AC 116 ms
56,176 KB
testcase_10 AC 117 ms
55,980 KB
testcase_11 AC 118 ms
56,312 KB
testcase_12 AC 117 ms
55,944 KB
testcase_13 AC 118 ms
56,140 KB
testcase_14 AC 124 ms
55,968 KB
testcase_15 AC 120 ms
55,976 KB
testcase_16 AC 118 ms
56,172 KB
testcase_17 AC 116 ms
56,080 KB
testcase_18 AC 116 ms
56,080 KB
testcase_19 AC 119 ms
56,016 KB
testcase_20 AC 116 ms
55,800 KB
testcase_21 AC 115 ms
55,764 KB
testcase_22 AC 119 ms
54,112 KB
testcase_23 AC 124 ms
55,812 KB
testcase_24 AC 125 ms
55,844 KB
testcase_25 AC 121 ms
55,804 KB
testcase_26 AC 121 ms
55,816 KB
testcase_27 AC 122 ms
55,732 KB
testcase_28 AC 120 ms
56,036 KB
testcase_29 AC 115 ms
56,056 KB
権限があれば一括ダウンロードができます

ソースコード

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=s.nextLong(),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